Noureddine RAMDI / cord.nvim: hybrid Lua+Rust Discord Rich Presence for Neovim

Created Mon, 04 May 2026 10:23:02 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

vyfor/cord.nvim

cord.nvim tackles the challenge of integrating Discord Rich Presence into Neovim by combining the strengths of Lua and Rust in a hybrid plugin architecture. This approach avoids forcing users to install Rust locally while still benefiting from Rust’s performance and robustness for Discord IPC communication.

What cord.nvim does and how it works

At its core, cord.nvim is a Neovim plugin that displays rich presence information on Discord, reflecting your current editing activity. The plugin is split into two parts: a Lua plugin that integrates with Neovim’s API and a Rust-based server executable that handles communication with Discord via IPC.

The Lua side manages Neovim events asynchronously, dynamically generates rich presence strings using templates, and detects the current workspace based on version control system (VCS) roots. Meanwhile, the Rust server binary, which is precompiled and fetched automatically from GitHub releases, handles the actual Discord IPC communication. This separation isolates the heavy lifting of Discord interaction away from Lua, improving responsiveness and reliability.

The architecture is event-driven and rate-limit aware, designed to respect Discord’s IPC constraints while providing up-to-date activity status. cord.nvim supports multiple Neovim package managers such as lazy.nvim, packer.nvim, rocks.nvim, and vim.pack, making it flexible to install in various user setups.

Technical strengths and tradeoffs

The standout feature of cord.nvim is its hybrid Lua+Rust architecture. Shipping a precompiled Rust server binary sidesteps the need for users to install Rust or compile the server themselves, which removes a major barrier for adoption. The plugin automatically downloads this binary using curl, which introduces a runtime dependency but streamlines installation for most users.

Under the hood, the Rust server is a dedicated long-running process that maintains a single Discord connection, even when multiple Neovim instances are open simultaneously. This design minimizes redundant IPC connections and handles idle detection and automatic switching between active Neovim instances.

On the Lua side, the plugin’s configuration is async-first and event-driven, which fits well with Neovim’s architecture. It features dynamic string templating to customize the rich presence text, and workspace detection is based on VCS roots, which aligns with common developer workflows.

The codebase balances complexity and performance. The tradeoff is that managing a separate server binary adds operational overhead compared to pure Lua plugins. However, this is justified by the more reliable and performant IPC communication enabled by Rust.

The plugin provides over 120 icons for 200+ file types, which covers a broad range of development environments. The code quality is solid, with clear separation of concerns between Lua and Rust components and careful handling of Discord’s rate limits.

Quick start

cord.nvim will automatically load with defaults; calling setup() is optional. The default configuration is found in the plugin documentation.

lazy.nvim

{
  'vyfor/cord.nvim'
}

Configuring

{
  'vyfor/cord.nvim',
   ---@type CordConfig
  opts = {
    -- ...
  }
}

packer.nvim

use {
  'vyfor/cord.nvim'
}

Configuring

use {
  'vyfor/cord.nvim',
  config = function()
    require('cord').setup {
      -- ...
    }
  end
}

rocks.nvim

Cord is available on LuaRocks.

:Rocks install cord.nvim

Configuring

require('cord').setup {
  -- ...
}

vim.pack (v0.12+)

vim.pack.add { 'https://github.com/vyfor/cord.nvim' }

Configuring

require('cord').setup {
  -- ...
}

Vim packages

Unix:

git clone https://github.com/vyfor/cord.nvim ~/.local/share/nvim/site/pack/plugins/start/cord.nvim

Windows (PowerShell):

git clone https://github.com/vyfor/cord.nvim $LOCALAPPDATA/nvim-data/site/pack/plugins/start/cord.nvim

Configuring

require('cord').setup {
  -- ...
}

Considerations

The plugin requires the Rust server executable to be present. By default, it fetches this automatically from GitHub using curl. If you prefer, you can manually download the binary from the releases page, rename it appropriately, and place it under the Neovim data directory.

You can also build the server from source using provided commands, but this requires Rust installed locally.

Verdict

cord.nvim is a practical solution for Neovim users who want Discord Rich Presence integration without the hassle of managing a Rust toolchain. The hybrid Lua+Rust architecture is a sensible tradeoff, delivering performance and reliability while hiding complexity behind precompiled binaries.

The automatic fetching of the server binary via curl simplifies setup but adds a runtime dependency that might be a consideration for minimal or offline environments. Managing a separate server binary adds some complexity compared to pure Lua plugins, but the benefits for IPC communication justify this.

Overall, cord.nvim is well suited for developers who want a richer presence on Discord reflecting their Neovim activity, with flexible configuration and solid multi-instance support. It’s a solid example of practical hybrid plugin design that balances DX and performance needs.


→ GitHub Repo: vyfor/cord.nvim ⭐ 620 · Lua