Tip
Just install the newpaper.nvim colorscheme so that it is like in the screenshot
- 🔍 Shows available actions for the word under the cursor (definition / references).
- 🖼️ Can display indicators inline as virtual text (e.g. next to the current line).
- 💬 Can output a statusline fragment (compatible with statusline and lualine).
- ⚙️ Configurable templates and colors for definition/references indicators.
- ⛔ Ignored patterns support (filetypes, filename substrings or Lua patterns).
- 🔒 Works only when LSP methods textDocument/definition and textDocument/references are available.
- ⚡️ Minimal and lightweight — forked to simplify and adapt behavior.
Install via your favorite package manager:
{
"yorik1984/action-hints.nvim",
opts = {}
},---@class ActionHintsTemplateEntry
---@field text string
---@field color string|nil
---@field link string|nil
---@class ActionHintsConfigTemplate
---@field definition ActionHintsTemplateEntry
---@field references ActionHintsTemplateEntry
---@class ActionHintsConfig
---@field template ActionHintsConfigTemplate
---@field ignored string[]
---@field use_virtual_text boolean
---@field statusline_colored boolean
---@type ActionHintsConfig
{
template = {
definition = {
text = " ⊛%s",
color = nil,
link = "Typedef",
},
references = {
text = " ↱%s",
color = nil,
link = "Type",
},
},
ignored = {},
use_virtual_text = true,
statusline_colored = true,
}- 🎨 Priority: if
template.*.coloris set → plugin applies that hex asfg. - 🔗 Otherwise → plugin applies
{ link = template.*.link }(default config always provides a link). - ⚡ No extra heuristics: "color" wins, otherwise "link".
- template.definition / template.references
text— format for virtual text.color—"#rrggbb"ornil. If set, this fixed color is used.link— hl group name (e.g."Typedef","Type") used whencolorisnil.
ignored— list of patterns/items to ignore.use_virtual_text— show virtual text (true/false).statusline_colored— if true, statusline groups link to main plugin groups.
- Force a color:
template.definition.color = "#AF0000"→ plugin appliesfg = "#AF0000"and respects it across theme changes.
{
template = {
definition = {
color = "#AF0000",
},
references = {
-- use built-in function to extract fg color from any group
color = require("action-hints").get_fg_color("Type"),
},
},
}- Theme-controlled (recommended default):
template.definition.color = nil; template.definition.link = "Typedef"→ plugin links to"Typedef", so the colorscheme decides the color.
{
template = {
definition = {
link = "Typedef",
},
references = {
link = "Type",
},
},
}- Ignored:
-
ignoredfield accepts Lua patterns (not shell globs). Patterns are matched against file paths (relative or absolute) — use^/$anchors,.and*for "any char" / "repeat", and escape special characters with%(e.g..→%.). -
%.min%.js$— ignore files ending with.min.js(.must be escaped) -
_spec%.lua$— ignore Lua spec files ending with_spec.lua -
Lua pattern special chars include:
^$()%.[]*+-?. Prefix with%to match them literally. -
Patterns are case‑sensitive by default on POSIX filesystems.
-
- ✅ Ship defaults with
color = nilso themes control appearance; let users override withcolorwhen they want a fixed hue. - 🖨️ When providing explicit colors, consider adding
ctermfgfor terminal compatibility. - 🔍 Ensure linked groups exist in common themes (Typedef/Type are commonly present).
Lualine and other statusline frameworks will respect these markers and apply the highlight groups accordingly. As a lualine component:
require("lualine").setup({
sections = {
lualine_x = { require("action-hints").statusline },
},
})| Command | Description |
|---|---|
:ChangeActionHintsStat |
Change the global plugin state |
Optionally add user keymap:
vim.keymap.set("n", "<leader>aa", ":ChangeActionHintsStat<CR>", { noremap = true })Quick reference for the highlight groups used by the plugin.
-
🟣
ActionHintsDefinition- Purpose: rendering "definition" indicators (Go to Definition).
- Source: uses
M.config.template.definition.colorif set; otherwise falls back tolink = M.config.template.definition.link(default"Typedef"). - Applied to: virtual text (virt_text).
-
🔵
ActionHintsReferences- Purpose: rendering "references" indicators (Go to Reference(s)).
- Source: uses
M.config.template.references.colorif set; otherwise falls back tolink = M.config.template.references.link(default"Type"). - Applied to: virtual text (virt_text).
-
🟢
ActionHintsDefinitionStatusLine- Purpose: statusline-specific styling for definition markers.
- Behavior: when
statusline_colored = truethis group is linked toActionHintsDefinition; otherwise it is set toNONE(no color). - Usage: use
%#ActionHintsDefinitionStatusLine#in statusline segments.
-
🟡
ActionHintsReferencesStatusLine- Purpose: statusline-specific styling for references markers.
- Behavior: when
statusline_colored = truethis group is linked toActionHintsReferences; otherwise it is set toNONE. - Usage: use
%#ActionHintsReferencesStatusLine#in statusline segments.
Note
- ⚡ Priority rule:
color(if provided) overrideslink. Ifcolor == nilthe plugin uses the configuredlinkso the active colorscheme controls appearance. - 🖥️ Statusline groups exist to keep statusline visuals consistent and optionally decoupled from virt_text groups.
Examples of how to set or change these highlight groups in your config or init.lua:
- Set highlight groups directly (hex color):
vim.api.nvim_set_hl(0, "ActionHintsDefinition", { fg = "#AF0000" })
vim.api.nvim_set_hl(0, "ActionHintsReferences", { fg = "#007200" })- Link to an existing highlight group:
vim.api.nvim_set_hl(0, "ActionHintsDefinition", { link = "Typedef" })
vim.api.nvim_set_hl(0, "ActionHintsReferences", { link = "Type" })- Foreground color from existing highlight group:
vim.api.nvim_set_hl(0, "ActionHintsDefinition", { fg = require("action-hints").get_fg_color("Typedef") })
vim.api.nvim_set_hl(0, "ActionHintsReferences", { fg = require("action-hints").get_fg_color("Type") })Tip
To make the icons and the words use the same highlighting(like in screenshot), configure your colorscheme so those highlight groups use the same colors. For example:
vim.api.nvim_set_hl(0, "LspReferenceRead", { link = "ActionHintsReferences", default = false })
vim.api.nvim_set_hl(0, "LspReferenceWrite", { link = "ActionHintsDefinition", default = false })