Skip to content

ObserverOfTime/nvimcord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

nvimcord

A Discord Rich Presence plugin for Neovim written in Lua.

Installation

packer

use 'ObserverOfTime/nvimcord'

plug

Plug 'ObserverOfTime/nvimcord'

dein

call dein#add('ObserverOfTime/nvimcord')

Configuration

-- NOTE: these are the defaults
require('nvimcord').setup {
    -- Start the RPC manually (boolean)
    autostart = false,
    -- Set the client ID (string)
    client_id = '954365489214291979',
    -- Use the filetype as the large icon (boolean)
    large_file_icon = true,
    -- Set the log level (enum)
    log_level = vim.log.levels.INFO,
    -- Get the workspace name (function|string)
    workspace_name = function()
      return --[[cwd basename]]
    end,
    -- Get the workspace URL (function|string)
    workspace_url = function()
      return ''
    end
}

Options can also be configured using Vim variables.

This can be useful when using exrc or a project plugin.

let g:nvimcord#autostart = v:false
let g:nvimcord#client_id = '954365489214291979'
let g:nvimcord#large_file_icon = v:true
let g:nvimcord#log_level = 2
" NOTE: these can only be defined as strings
let g:nvimcord#workspace_name = ''
let g:nvimcord#workspace_url = ''

Filetypes

local fts = require 'nvimcord.filetypes'

-- NOTE: the asset can also be an image URL

-- override options
fts.filetype['vim'].name = 'Vim Script'
fts.filetype['vim'].asset = 'neovim'

-- new filetype
fts.filetype['teal'] = {name = 'Teal', asset = 'lua'}

-- new pattern
fts.pattern['^%.gitkeep$'] = {name = 'git keep', asset = 'git'}

-- ignore filetype
fts.ignore.filetype['vim'] = true

-- ignore filename
fts.ignore.filename['init.vim'] = true

Commands

:NvimcordUpdate

Start or update the rich presence.

:NvimcordStop

Stop the rich presence.

:NvimcordFiletypes

List the supported filetypes.

:NvimcordAssets

List the supported assets.

TODO

  • Ignore by filename
  • Cache filename patterns
  • Detect workspace through git
  • Warn when pipe doesn't exist
  • Set idle status after some time

Assets

The assets are available here.

Sources

Palette

The icons use the basic colours from file-icons/atom.

  • #ac4142 red
  • #90a959 green
  • #f4bf75 yellow
  • #6a9fb5 blue
  • #8f5536 maroon
  • #aa759f purple
  • #d28445 orange
  • #75b5aa cyan
  • #ff00cc pink
  • #7f7f7f grey

Alternatives