1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-12-28 11:02:34 +01:00
Discord Rich Presence for Neovim
Find a file
Kyle Chui 2927ceb17d
Add context-specific status (#12)
* Add context-specific status
* Add "browsing" support for file tree explorers
* Add commit and netrw support
* Fix git commit file recognition
* Add readonly clause
2021-05-17 19:59:58 -07:00
autoload Support peer-to-peer workspace state management 2021-03-18 19:10:04 -07:00
lua Add context-specific status (#12) 2021-05-17 19:59:58 -07:00
plugin Move autocmd to autoload and validate setup opts 2021-01-03 11:29:19 -08:00
.gitignore Initial commit 2021-01-03 01:22:15 -08:00
.luacheckrc Update README and luacheckrc 2021-05-13 19:57:38 -07:00
README.md Update README and luacheckrc 2021-05-13 19:57:38 -07:00

presence.nvim

Features | Installation | Configuration | Troubleshooting | Development | Contributing

Discord Rich Presence plugin for Neovim

demo.gif

Features

  • Simple and unobtrusive
  • Support for macOS, Linux, and Windows*
  • No Python/Node providers (or CoC) required
  • Startup time is fast(er than other Rich Presence plugins, by kind of a lot)
  • Written in Lua and configurable in Lua (but also configurable in VimL if you want)

Installation

Use your favorite plugin manager

Notes

Configuration

Rich Presence works right out of the box after installation, so configuration is optional. For those that do want to override default behaviors, however, configuration options are available in either Lua or VimL.

Lua

Require the plugin and call setup with a config table with any of the following keys:

Presence = require("presence"):setup({
    -- This config table shows all available config options with their default values
    auto_update       = true,                       -- Update activity based on autocmd events (if `false`, map or manually execute `:lua Presence:update()`)
    editing_text      = "Editing %s",               -- Editing format string (either string or function(filename: string|nil, buffer: string): string)
    workspace_text    = "Working on %s",            -- Workspace format string (either string or function(git_project_name: string|nil, buffer: string): string)
    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  = 15,                         -- Number of seconds to debounce TextChanged events (or calls to `:lua Presence:update(<buf>, true)`)
})

VimL

Or if global variables are more your thing, you can use any of the following instead:

let g:presence_auto_update       = 1
let g:presence_editing_text      = "Editing %s"
let g:presence_workspace_text    = "Working on %s"
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  = 15

Troubleshooting

  • Ensure that Discord is running
  • Ensure that your Neovim version is on 0.5
  • Ensure Game Activity is enabled in your Discord settings
  • Enable logging and inspect the logs after opening a buffer
  • If there is a Failed to get Discord IPC socket error, your particular OS may not yet be supported
    • If you don't see an existing issue or card for your OS, create a prefixed issue (e.g. [Void Linux])

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!

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.