1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-12-29 19:32:05 +01:00
Discord Rich Presence for Neovim
Find a file
2021-03-11 10:25:30 -08:00
autoload Move autocmd to autoload and validate setup opts 2021-01-03 11:29:19 -08:00
lua Add yaml and abook file assets 2021-03-11 10:25:30 -08: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 Initial commit 2021-01-03 01:22:15 -08:00
README.md Use workspace text option when no project is detected 2021-03-08 19:03:25 -08:00

presence.nvim

Discord Rich Presence plugin for Neovim.

demo.gif

Features

  • Simple and unobtrusive
  • 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

  • packer: use 'andweeb/presence.nvim'
  • vim-plug: Plug 'andweeb/presence.nvim'

Notes

Configuration

Rich Presence works right out of the box after installation. To override default behaviors, configuration options are available in both Lua and 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")
})

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

Contributing

Pull requests are very welcome! Here some open todo items:

  • Use named pipes to support Windows
  • Expose file assets table as a configurable option
  • Retry connection after initial setup or a closed pipe (i.e. after quitting Discord app)
  • Attempt to connect to a range of pipes from discord-ipc-0 to discord-ipc-9 (see note)
  • Set activity on other autocommands (:h events)

Discord asset additions and changes are also welcome! Supported file types can be found in file_assets.lua and their assets can be found in this folder.