1
0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-11-23 20:37:50 +01:00
presence.nvim/README.md

78 lines
5.1 KiB
Markdown
Raw Normal View History

<img src="https://gist.githubusercontent.com/andweeb/df3216345530234289b87cf5080c2c60/raw/8de399cfed82c137f793e9f580027b5246bc4379/presence.nvim.png" alt="presence.nvim">&#x200B;
2021-03-01 09:34:30 -08:00
2021-05-13 19:57:38 -07:00
**[Features](#features)** | **[Installation](#installation)** | **[Configuration](#configuration)** | **[Troubleshooting](#troubleshooting)** | **[Development](#development)** | **[Contributing](#contributing)**
2021-05-13 19:57:38 -07:00
> Discord [Rich Presence](https://discord.com/rich-presence) plugin for [Neovim](https://neovim.io)
2021-03-01 09:34:30 -08:00
<img src="https://gist.githubusercontent.com/andweeb/df3216345530234289b87cf5080c2c60/raw/4b07351547ae9a6bfdcbc1f915889b90a5349242/presence-demo.gif" alt="demo.gif">
## Features
* Simple and unobtrusive
2021-04-28 21:17:30 -07:00
* Support for macOS, Linux, and Windows[\*](#notes)
2021-03-01 09:34:30 -08:00
* No Python/Node providers (or CoC) required
* Startup time is fast(er than other Rich Presence plugins, by [kind of a lot](https://github.com/andweeb/presence.nvim/wiki/Plugin-Comparisons))
* Written in Lua and configurable in Lua (but also configurable in VimL if you want)
## Installation
Use your favorite plugin manager
* [vim-plug](https://github.com/junegunn/vim-plug): `Plug 'andweeb/presence.nvim'`
2021-05-13 19:57:38 -07:00
* [packer.nvim](https://github.com/wbthomason/packer.nvim): `use 'andweeb/presence.nvim'`
2021-03-01 09:34:30 -08:00
#### Notes
2021-04-28 21:17:30 -07:00
* Requires [Neovim nightly](https://github.com/neovim/neovim/releases/tag/nightly) (0.5)
* Windows is [partially supported](https://github.com/andweeb/presence.nvim/projects/1#card-60537963), WSL is [not yet supported](https://github.com/andweeb/presence.nvim/projects/1#card-60537961)
2021-03-01 09:34:30 -08:00
## 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.
2021-03-01 09:34:30 -08:00
### Lua
Require the plugin and call `setup` with a config table with any of the following keys:
```lua
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)
2021-03-01 09:34:30 -08:00
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)`)
2021-03-01 09:34:30 -08:00
})
```
### VimL
Or if global variables are more your thing, you can use any of the following instead:
```viml
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
2021-03-01 09:34:30 -08:00
```
## Troubleshooting
* Ensure that Discord is running
2021-05-13 19:57:38 -07:00
* 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
2021-05-13 19:57:38 -07:00
* Set the [`log_level`](#lua) setup option or [`g:presence_log_level`](#viml) to `"debug"`
* Load a file and inspect the logs with `:messages`
* If there is a `Failed to get Discord IPC socket` error, your particular OS may not yet be supported
2021-05-13 19:57:38 -07:00
* If you don't see an existing [issue](https://github.com/andweeb/presence.nvim/issues) or [card](https://github.com/andweeb/presence.nvim/projects/1#column-14183588) for your OS, create a prefixed [issue](https://github.com/andweeb/presence.nvim/issues/new) (e.g. `[Void Linux]`)
## Development
* Clone the repo: `git clone https://github.com/andweeb/presence.nvim.git`
* Enable [logging](#configuration) 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](https://github.com/mpeterv/luacheck/) errors: `luacheck lua`
2021-03-01 09:34:30 -08:00
## Contributing
Pull requests are very welcome, feel free to open an issue to work on any of the open [todo items](https://github.com/andweeb/presence.nvim/projects/1?add_cards_query=is%3Aopen)!
2021-03-01 09:34:30 -08:00
Asset additions and changes are also welcome! Supported file types can be found in [`file_assets.lua`](lua/presence/file_assets.lua) and their referenced asset files can be found [in this folder](https://www.dropbox.com/sh/j8913f0gav3toeh/AADxjn0NuTprGFtv3Il1Pqz-a?dl=0).