a68355145c
Resolves #28 |
||
---|---|---|
autoload | ||
lua | ||
plugin | ||
.gitignore | ||
.luacheckrc | ||
README.md |
Features | Installation | Configuration | Troubleshooting | Development | Contributing
Discord Rich Presence plugin for Neovim
Features
- Light and unobtrusive
- No Python/Node providers (or CoC) required
- Cross-platform support: macOS, nixOS, Linux, Windows*, WSL*
- Startup time is fast(er than other Rich Presence plugins, by kind of a lot)
- Written in Lua and highly configurable in Lua (but also configurable in VimL if you want)
- Manages Rich Presence across multiple Neovim instances in various environments (tmux panes/windows, ssh sessions, terminal tabs/windows, etc.)
Installation
Use your favorite plugin manager
- vim-plug:
Plug 'andweeb/presence.nvim'
- packer.nvim:
use 'andweeb/presence.nvim'
Notes
- Requires Neovim 0.5 or higher
- Rich Presence should work automatically after installation (unless you're using WSL, in which case see here)
Configuration
Configuration is not necessary for Rich Presence to work. But for those that want to override the default configs, the following options are available to configure in either Lua or VimL.
Lua
Require the plugin and call setup
with a config table with one or more of the following keys:
-- The setup config table shows all available config options with their default values:
require("presence"):setup({
-- General options
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image
main_image = "neovim", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer
git_commit_text = "Committing changes", -- Format string rendered when commiting changes in git
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer
workspace_text = "Working on %s", -- Workspace format string (either string or function(git_project_name: string|nil, buffer: string): string)
line_number_text = "Line %s out of %s", -- Line number format string (for when enable_line_number is set to true)
})
VimL
Or if global variables are more your thing, you can use any of the following instead:
" General options
let g:presence_auto_update = 1
let g:presence_neovim_image_text = "The One True Text Editor"
let g:presence_main_image = "neovim"
let g:presence_client_id = "793271441293967371"
let g:presence_log_level
let g:presence_debounce_timeout = 10
let g:presence_enable_line_number = 0
" Rich Presence text options
let g:presence_editing_text = "Editing %s"
let g:presence_file_explorer_text = "Browsing %s"
let g:presence_git_commit_text = "Committing changes"
let g:presence_plugin_manager_text = "Managing plugins"
let g:presence_reading_text = "Reading %s"
let g:presence_workspace_text = "Working on %s"
let g:presence_line_number_text = "Line %s out of %s"
Troubleshooting
- Ensure that Discord is running
- Ensure that your Neovim version is 0.5 or higher
- Ensure Game Activity is enabled in your Discord settings
- Enable logging and inspect the logs after opening a buffer
- Set the
log_level
setup option org:presence_log_level
to"debug"
- Load a file and inspect the logs with
:messages
- Set the
- If there is a
Failed to determine Discord IPC socket
error, your particular OS may not yet be supported - Still not working and need help? Create a new issue!
Development
- Clone the repo:
git clone https://github.com/andweeb/presence.nvim.git
- Enable logging and ensure that
presence.nvim
is not in the list of vim plugins in your config - Run
nvim
with your local changes:nvim --cmd 'set rtp+=path/to/your/local/presence.nvim' file.txt
- Ensure that there are no luacheck errors:
luacheck lua
Contributing
Pull requests are very welcome, feel free to open an issue to work on any of the open todo items or message droob#1322 on Discord!
Asset additions and changes are also welcome! Supported file types can be found in file_assets.lua
and their referenced asset files can be found in this folder.