๐ŸงŠ Helpview.nvim

February 5, 2025 ยท View on GitHub

A hackable & fancy vimdoc viewer for Neovim.

๐Ÿ“– Table of contents

โœจ Features

  • Adds various decorations to make vimdoc files nicer to look at.

  • No external dependencies(other than the vimdoc parser)!

  • Supports a variety of vimdoc syntaxes such as,

    • Arguments.
    • Code blocks.
    • Headings(& column headings).
    • Highlight group names.
    • Horizontal rules.
    • Inline codes.
    • Keycodes.
    • Vim modeline.
    • Notes.
    • Option links.
    • Tags.
    • Tag links.
  • Custom renderer support.

  • Dynamic highlight groups.

  • Hybrid mode for viewing & writing together.

  • Splitview for side-by-side viewing of the file being edited.

  • Help command wrappers(:Help, :H) to change where help is shown.

๐Ÿ“š Requirements

System,

  • Neovim: 0.10.3

Colorscheme,

  • Any tree-sitter based colorscheme is recommended.

External icon providers,

Note

You need to change the config to use the desired icon provider.

{
    preview = {
        icon_provider = "internal", -- "mini" or "devicons"
    }
}

Parsers,

Tip

You can use nvim-treesitter to easily install parsers. You can install all the parsers with the following command,

:TSInstall vimdoc
  • vimdoc

Fonts,

  • Nerd fonts are recommended.

Tip

It is recommended to run :checkhealth helpview after installing the plugin to check if any potential issues exist.

๐Ÿ“ Installation

๐Ÿงฉ Vim-plug

Add this to your plugin list.

Plug "OXY2DEV/helpview.nvim"

๐Ÿ’ค Lazy.nvim

Warning

Do not lazy load this plugin as it is already lazy-loaded.

Lazy-loading will cause more time for the previews to load when starting Neovim.

The plugin should be loaded after your colorscheme to ensure the correct highlight groups are used.

-- For `plugins/helpview.lua` users.
return {
    "OXY2DEV/helpview.nvim",
    lazy = false
};
-- For `plugins.lua` users.
{
    "OXY2DEV/helpview.nvim",
    lazy = false
},

๐Ÿฆ  Mini.deps

local MiniDeps = require("mini.deps");

MiniDeps.add({
    source = "OXY2DEV/helpview.nvim"
});

๐ŸŒ’ Rocks.nvim

Warning

luarocks package may sometimes be a bit behind main.

:Rocks install helpview.nvim

๐Ÿ“ฅ GitHub release

Tagged releases can be found in the release page.

Note

Github releases may sometimes be slightly behind main.

๐Ÿšจ Development version

You can use the dev branch to use test features.

Warning

Development releases can contain breaking changes and experimental changes. Use at your own risk!

return {
    "OXY2DEV/helpview.nvim",
    branch = "dev",
    lazy = false
};

๐Ÿงญ Configuration

Check the wiki for the entire configuration table. A simplified version is given below.

--- Configuration for `helpview.nvim`.
---@class helpview.config
---
--- Preview options.
---@field preview? helpview.preview
---
--- Configuration options for vimdoc.
---@field vimdoc? helpview.vimdoc
---
--- Custom highlight groups.
---@field highlight_groups? table[]
---
--- Custom renderers
---@field renderers? { [string]: function }
{
	renderers = {},

	preview = {
		enable = true,
		enable_hybrid_mode = true,

		modes = { "n", "c", "no" },
		hybrid_modes = {},
		linewise_hybrid_mode = false,

		filetypes = { "help" },
		ignore_previews = {},
		ignore_buftypes = {},
		condition = nil,

		max_buf_lines = 500,
		draw_range = { 2 * vim.o.lines, 2 * vim.o.lines },
		edit_range = { 0, 0 },

		debounce = 150,
		callbacks = {},

		icon_provider = "internal",

		splitview_winopts = { split = "right" },
		preview_winopts = { width = math.floor(80) }
	},

    vimdoc = {
        arguments = {},
        code_blocks = {},
        headings = {},
        highlight_groups = {},
        horizontal_rules = {},
        inline_codes = {},
        keycodes = {},
        modelines = {},
        notes = {},
        optionlinks = {},
        tags = {},
        taglinks = {},
        urls = {}
    }
}

๐ŸŽ‡ Commands

This plugin follows the sub-commands approach for creating commands. There is only a single :Helpview command.

It comes with the following sub-commands,

Note

When no sub-command name is provided(or an invalid sub-command is used) :Helpview will run :Helpview Toggle.

Sub-commandArgumentsDescription
StartnoneAllows attaching to new buffers.
StopnonePrevents attaching to new buffers.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
attachbuffer, integerAttaches to buffer.
detachbuffer, integerDetaches from buffer.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
EnablenoneEnables preview globally.
DisablenoneDisables preview globally.
TogglenoneToggles preview globally.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
enablebuffer, integerEnables preview for buffer.
disablebuffer, integerDisables preview for buffer.
togglebuffer, integerToggles preview for buffer.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
splitOpenbuffer, integerOpens splitview for buffer.
splitClosenoneCloses any open splitview.
splitTogglenoneToggles splitview.
splitRedrawnoneUpdates splitview contents.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
RendernoneUpdates preview of all active buffers.
ClearnoneClears preview of all active buffer.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
renderbuffer, integerRenders preview for buffer.
clearbuffer, integerClears preview for buffer.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
toggleAllnoneDeprecated version of Toggle.
enableAllnoneDeprecated version of Enable.
disableAllnoneDeprecated version of Disable.
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
traceExportnoneExports trace logs to trace.txt.
traceShownoneShows trace logs in a window.

Tip

buffer defaults to the current buffer. So, you can run commands on the current buffer without providing the buffer.

:Helpview toggle "Toggles preview of the current buffer.

๐ŸŽจ Highlight groups

helpview.nvim creates a number of primary highlight groups that are used by most of the decorations.

Important

These groups are all generated during runtime and as such their colors may look different.

If you want to create your own dynamic highlight groups or modify existing ones, see the custom highlight groups section.

Highlight groupGenerated fromDefault
HelpviewPalette0Normal(bg) + Comment(fg)fg: #9399b2 bg: #35374a
HelpviewPalette0FgComment(fg)fg: #9399b2
HelpviewPalette0BgNormal(bg) + Comment(fg)bg: #35374a
HelpviewPalette0SignNormal(bg) + Comment(fg), LineNr(bg)fg: #9399b2
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette1Normal(bg) + markdownH1(fg)fg: #f38ba8 bg: #4d3649
HelpviewPalette1FgmarkdownH1(fg)fg: #f38ba8
HelpviewPalette1BgNormal(bg) + markdownH1(fg)bg: #4d3649
HelpviewPalette1SignNormal(bg) + markdownH1(fg), LineNr(bg)fg: #f38ba8
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette2Normal(bg) + markdownH2(fg)fg: #f9b387 bg: #4d3d43
HelpviewPalette2FgmarkdownH2(fg)fg: #f9b387
HelpviewPalette2BgNormal(bg) + markdownH2(fg)bg: #4d3d43
HelpviewPalette2SignNormal(bg) + markdownH2(fg), LineNr(bg)fg: #f9b387
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette3Normal(bg) + markdownH3(fg)fg: #f9e2af bg: #4c474b
HelpviewPalette3FgmarkdownH3(fg)fg: #f9e2af
HelpviewPalette3BgNormal(bg) + markdownH3(fg)bg: #4c474b
HelpviewPalette3SignNormal(bg) + markdownH3(fg), LineNr(bg)fg: #f9e2af
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette4Normal(bg) + markdownH4(fg)fg: #a6e3a1 bg: #3c4948
HelpviewPalette4FgmarkdownH4(fg)fg: #a6e3a1
HelpviewPalette4BgNormal(bg) + markdownH4(fg)bg: #3c4948
HelpviewPalette4SignNormal(bg) + markdownH4(fg), LineNr(bg)fg: #a6e3a1
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette5Normal(bg) + markdownH5(fg)fg: #74c7ec bg: #314358
HelpviewPalette5FgmarkdownH5(fg)fg: #74c7ec
HelpviewPalette5BgNormal(bg) + markdownH5(fg)bg: #314358
HelpviewPalette5SignNormal(bg) + markdownH5(fg), LineNr(bg)fg: #74c7ec
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette6Normal(bg) + markdownH6(fg)fg: #b4befe bg: #3c405b
HelpviewPalette6FgmarkdownH6(fg)fg: #b4befe
HelpviewPalette6BgNormal(bg) + markdownH6(fg)bg: #3c405b
HelpviewPalette6SignNormal(bg) + markdownH6(fg), LineNr(bg)fg: #b4befe
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewPalette7Normal(bg) + @conditional(fg)fg: #cba6f7 bg: #403b5a
HelpviewPalette7Fg@conditional(fg)fg: #cba6f7
HelpviewPalette7BgNormal(bg) + @conditional(fg)bg: #403b5a
HelpviewPalette7SignNormal(bg) + @conditional(fg), LineNr(bg)fg: #cba6f7

The source highlight group's values are turned into Lab color-space and then mixed to reduce unwanted results.

These groups are then used as links by other groups responsible for various preview elements,

Note

These groups exist for the sake of backwards compatibility and ease of use.

You will see something like fg: Normal, it means the fg of Normal was used as the fg of that group.

Highlight groupvalue
HelpviewCodebg*: normal ยฑ 5%(L)
HelpviewCodeInfobg*: normal ยฑ 5%(L), fg: comment
HelpviewCodeFgfg*: normal ยฑ 5%(L)
HelpviewInlineCodefg*: normal ยฑ 10%(L)
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewIcon0link**: HelpviewPalette0Fg
HelpviewIcon1link**: HelpviewPalette1Fg
HelpviewIcon2link**: HelpviewPalette5Fg
HelpviewIcon3link**: HelpviewPalette4Fg
HelpviewIcon4link**: HelpviewPalette3Fg
HelpviewIcon5link**: HelpviewPalette2Fg
โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”
HelpviewGradient0fg: Normal
HelpviewGradient1fg***: lerp(Normal, Title, 1/9)
HelpviewGradient2fg***: lerp(Normal, Title, 2/9)
HelpviewGradient3fg***: lerp(Normal, Title, 3/9)
HelpviewGradient4fg***: lerp(Normal, Title, 4/9)
HelpviewGradient5fg***: lerp(Normal, Title, 5/9)
HelpviewGradient6fg***: lerp(Normal, Title, 6/9)
HelpviewGradient7fg***: lerp(Normal, Title, 7/9)
HelpviewGradient8fg***: lerp(Normal, Title, 8/9)
HelpviewGradient9fg: Title

* = The color is converted to HSL and it's luminosity(L) is increased/decreased by the specified amount.

** = The background color of HelpviewCode is added to the groups.

*** = Linearly interpolated value between 2 highlight groups fg.

There are also highlight groups that are made using the default highlight groups

Highlight groupInherited from
HelpviewTaglink@markup.link.vimdoc
HelpviewTag@label.vimdoc
HelpviewTag@label.vimdoc
HelpviewOptionlink@markup.link.vimdoc
HelpviewKeycode@string.special.vimdoc
HelpviewArgument@variable.parameter.vimdoc