A Neovim plugin for displaying inline diagnostic messages with customizable styles and icons.
- Requirements
- Installation
- Configuration
- Custom Styling
- Presets
- Examples
- API
- Integrations
- Comparison with Neovim's Built-in
virtual_lines - Troubleshooting
- Neovim >= 0.10
{
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy",
priority = 1000,
config = function()
require("tiny-inline-diagnostic").setup()
vim.diagnostic.config({ virtual_text = false }) -- Disable Neovim's default virtual text diagnostics
end,
}{
{
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy",
priority = 1000,
opts = {},
},
{
"neovim/nvim-lspconfig",
opts = { diagnostics = { virtual_text = false } },
},
}Important
This disables Neovim's built-in virtual text diagnostics to prevent conflicts and duplicate displays. The plugin provides its own inline diagnostic display.
Configuration
require("tiny-inline-diagnostic").setup({
options = {
multilines = {
enabled = true,
},
},
})
Configuration
require("tiny-inline-diagnostic").setup({
options = {
show_source = {
enabled = true,
},
},
})
Configuration
require("tiny-inline-diagnostic").setup({
options = {
add_messages = {
display_count = true,
},
multilines = {
enabled = true,
},
},
})
require("tiny-inline-diagnostic").setup({
-- Choose a preset style for diagnostic appearance
-- Available: "modern", "classic", "minimal", "powerline", "ghost", "simple", "nonerdfont", "amongus"
preset = "modern",
-- Make diagnostic background transparent
transparent_bg = false,
-- Make cursorline background transparent for diagnostics
transparent_cursorline = true,
-- Customize highlight groups for colors
-- Use Neovim highlight group names or hex colors like "#RRGGBB"
hi = {
error = "DiagnosticError", -- Highlight for error diagnostics
warn = "DiagnosticWarn", -- Highlight for warning diagnostics
info = "DiagnosticInfo", -- Highlight for info diagnostics
hint = "DiagnosticHint", -- Highlight for hint diagnostics
arrow = "NonText", -- Highlight for the arrow pointing to diagnostic
background = "CursorLine", -- Background highlight for diagnostics
mixing_color = "Normal", -- Color to blend background with (or "None")
},
-- List of filetypes to disable the plugin for
disabled_ft = {},
options = {
-- Display the source of diagnostics (e.g., "lua_ls", "pyright")
show_source = {
enabled = false, -- Enable showing source names
if_many = false, -- Only show source if multiple sources exist for the same diagnostic
},
-- Use icons from vim.diagnostic.config instead of preset icons
use_icons_from_diagnostic = false,
-- Color the arrow to match the severity of the first diagnostic
set_arrow_to_diag_color = false,
-- Throttle update frequency in milliseconds to improve performance
-- Higher values reduce CPU usage but may feel less responsive
-- Set to 0 for immediate updates (may cause lag on slow systems)
throttle = 20,
-- Minimum number of characters before wrapping long messages
softwrap = 30,
-- Control how diagnostic messages are displayed
-- NOTE: When using display_count = true, you need to enable multiline diagnostics with multilines.enabled = true
-- If you want them to always be displayed, you can also set multilines.always_show = true.
add_messages = {
messages = true, -- Show full diagnostic messages
display_count = false, -- Show diagnostic count instead of messages when cursor not on line
use_max_severity = false, -- When counting, only show the most severe diagnostic
show_multiple_glyphs = true, -- Show multiple icons for multiple diagnostics of same severity
},
-- Settings for multiline diagnostics
multilines = {
enabled = false, -- Enable support for multiline diagnostic messages
always_show = false, -- Always show messages on all lines of multiline diagnostics
trim_whitespaces = false, -- Remove leading/trailing whitespace from each line
tabstop = 4, -- Number of spaces per tab when expanding tabs
},
-- Show all diagnostics on the current cursor line, not just those under the cursor
show_all_diags_on_cursorline = false,
-- Display related diagnostics from LSP relatedInformation
show_related = {
enabled = true, -- Enable displaying related diagnostics
max_count = 3, -- Maximum number of related diagnostics to show per diagnostic
},
-- Enable diagnostics display in insert mode
-- May cause visual artifacts; consider setting throttle to 0 if enabled
enable_on_insert = false,
-- Enable diagnostics display in select mode (e.g., during auto-completion)
enable_on_select = false,
-- Handle messages that exceed the window width
overflow = {
mode = "wrap", -- "wrap": split into lines, "none": no truncation, "oneline": keep single line
padding = 0, -- Extra characters to trigger wrapping earlier
},
-- Break long messages into separate lines
break_line = {
enabled = false, -- Enable automatic line breaking
after = 30, -- Number of characters before inserting a line break
},
-- Custom function to format diagnostic messages
-- Receives diagnostic object, returns formatted string
-- Example: function(diag) return diag.message .. " [" .. diag.source .. "]" end
format = nil,
-- Virtual text display priority
-- Higher values appear above other plugins (e.g., GitBlame)
virt_texts = {
priority = 2048,
},
-- Filter diagnostics by severity levels
-- Remove severities you don't want to display
severity = {
vim.diagnostic.severity.ERROR,
vim.diagnostic.severity.WARN,
vim.diagnostic.severity.INFO,
vim.diagnostic.severity.HINT,
},
-- Events that trigger attaching diagnostics to buffers
-- Default is {"LspAttach"}; change only if plugin doesn't work with your LSP setup
overwrite_events = nil,
-- Automatically disable diagnostics when opening diagnostic float windows
override_open_float = false,
},
})Override preset signs and blending:
require("tiny-inline-diagnostic").setup({
signs = {
left = "",
right = "",
diag = "●",
arrow = " ",
up_arrow = " ",
vertical = " │",
vertical_end = " └",
},
blend = {
factor = 0.22,
},
})Note
Providing signs or blend tables will completely replace the preset defaults. If you want to use a preset's styling, only set the preset option and do not include signs or blend in your configuration. Mixing presets with custom signs/blend is not supported.
local diag = require("tiny-inline-diagnostic")
-- Change settings dynamically
diag.change(blend_opts, highlight_opts)
-- Get diagnostic under cursor
local diag_under_cursor = diag.get_diagnostic_under_cursor()
-- Control visibility
diag.enable()
diag.disable()
diag.toggle()
-- Filter severities
diag.change_severities({ vim.diagnostic.severity.ERROR, vim.diagnostic.severity.WARN })To automaticallm hide inline diagnostics when opening Neovim's diagnostic float windows, override the function to disable diagnostics before opening the float and re-enable them after closing.
vim.diagnostic.open_float = require("tiny-inline-diagnostic.override").open_floatThis wrapper function temporarily disables the plugin when a diagnostic float is opened, preventing overlap or visual interference, and restores the diagnostics once the float is closed. It's a lightweight override that doesn't modify the original open_float behavior beyond adding the disable/enable logic.
The plugin integrates with sidekick.nvim to automatically disable diagnostics when the sidekick NES is shown and re-enable them when hidden. This prevents visual clutter...
local disabled = false
return {
{
"folke/sidekick.nvim",
opts = { nes = { enabled = true } },
config = function(_, opts)
require("sidekick").setup(opts)
vim.api.nvim_create_autocmd("User", {
pattern = "SidekickNesHide",
callback = function()
if disabled then
disabled = false
require("tiny-inline-diagnostic").enable()
end
end,
})
vim.api.nvim_create_autocmd("User", {
pattern = "SidekickNesShow",
callback = function()
disabled = true
require("tiny-inline-diagnostic").disable()
end,
})
end,
},
}This setup listens for SidekickNesShow and SidekickNesHide events to toggle the diagnostics accordingly.
As of Neovim 0.11, the diagnostic system supports a virtual_lines option (see neovim/neovim#31959). This built-in feature renders diagnostics as virtual lines below the affected code. However, there differences :
Built-in virtual_lines: Inserts virtual lines into the buffer, which shifts all subsequent text down. This can be distracting during navigation, as the visible text "jumps" whenever diagnostics appear or disappear.
tiny-inline-diagnostic.nvim: Renders diagnostics as inline virtual text that overlays the code without moving any lines. This approach eliminates visual disruption, maintaining a good editing experience. Additionally, this plugin is highly configurable with multiple presets, extensive display options (overflow handling, multiline support, diagnostic counts, related information), custom formatting, and fine control over when and how diagnostics appear.
For users who prefer diagnostics to remain unobtrusive and non-intrusive while having extensive customization options, tiny-inline-diagnostic.nvim provides a cleaner, more flexible alternative.
- Colors wrong: Adjust
hitable ormixing_color - Default diagnostics show: Add
vim.diagnostic.config({ virtual_text = false }) - Overridden by plugins: Increase
virt_texts.priority - No diagnostics: Check LSP config and
disabled_ft









