alexpasmantier/krust.nvim

πŸ¦€ Nicer Rust diagnostics for Neovim

Lua

131

19 commits

updated Dec 4, 2025

See the code

README

krust.nvim

Neovim Lua

πŸ¦€ Nicer Rust diagnostics for Neovim.

krust.nvim screenshot

Why?

To be able to read complete Rust compiler diagnostics in Neovim with proper colors and formatting, similar to how they appear when running cargo in the terminal.

Installation

lazy.nvim

{
  "alexpasmantier/krust.nvim",
  ft = "rust",
}

packer.nvim

use {
  "alexpasmantier/krust.nvim",
  ft = "rust",
}

Configuration

Krust automatically configures rust-analyzer to send colored diagnostics. No keybindings are set by default to avoid conflicts.

-- With lazy.nvim
{
  "alexpasmantier/krust.nvim",
  ft = "rust",
  opts = {
    keymap = "<leader>k",  -- Set a keymap for Rust buffers (default: false)
    float_win = {
      border = "rounded",    -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
      auto_focus = false,    -- Auto-focus float (default: false)
    },
  },
}

Note: If rust-analyzer starts before krust.nvim loads, you may need :LspRestart for colors to appear. To avoid this, load krust.nvim before your LSP config.

Usage

Use the command:

:Krust

Or call from Lua:

require('krust').render()

Behavior

Krust tries to behave like LSP hover documentation windows:

  • First invocation: Opens the floating window (not focused)
  • Second invocation: Enters the floating window so you may scroll
  • q or <Esc>: Closes the window

Credits

This was inspired by rustaceanvim's diagnostic rendering.

cargo
clippy
diagnostics
error-messages
neovim
neovim-plugin
neovim-plugins
nvim
nvim-plugin
rust
rust-analyzer

Contributors

alexpasmantier/krust.nvim

πŸ¦€ Nicer Rust diagnostics for Neovim

Lua

131

19 commits

updated Dec 4, 2025

See the code

README

krust.nvim

Neovim Lua

πŸ¦€ Nicer Rust diagnostics for Neovim.

krust.nvim screenshot

Why?

To be able to read complete Rust compiler diagnostics in Neovim with proper colors and formatting, similar to how they appear when running cargo in the terminal.

Installation

lazy.nvim

{
  "alexpasmantier/krust.nvim",
  ft = "rust",
}

packer.nvim

use {
  "alexpasmantier/krust.nvim",
  ft = "rust",
}

Configuration

Krust automatically configures rust-analyzer to send colored diagnostics. No keybindings are set by default to avoid conflicts.

-- With lazy.nvim
{
  "alexpasmantier/krust.nvim",
  ft = "rust",
  opts = {
    keymap = "<leader>k",  -- Set a keymap for Rust buffers (default: false)
    float_win = {
      border = "rounded",    -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
      auto_focus = false,    -- Auto-focus float (default: false)
    },
  },
}

Note: If rust-analyzer starts before krust.nvim loads, you may need :LspRestart for colors to appear. To avoid this, load krust.nvim before your LSP config.

Usage

Use the command:

:Krust

Or call from Lua:

require('krust').render()

Behavior

Krust tries to behave like LSP hover documentation windows:

  • First invocation: Opens the floating window (not focused)
  • Second invocation: Enters the floating window so you may scroll
  • q or <Esc>: Closes the window

Credits

This was inspired by rustaceanvim's diagnostic rendering.

cargo
clippy
diagnostics
error-messages
neovim
neovim-plugin
neovim-plugins
nvim
nvim-plugin
rust
rust-analyzer

Contributors

Languages

Lua

99.1%