Home

Awesome

title: readme description: Readme for dynamic help authors: max categories: docs created: 2022-04-20 version: 0.0.11

Features

Usage

Install with a package manager.

use("max397574/dyn_help.nvim")

Floating Help

Basic

You can use this

require("dynamic_help").float_help(<help_tag>)

to open the help for this in a floating window.

Advanced (also more useful)

It's recommended to use a function in a mapping like this:

vim.keymap.set(
  "n", -- normal mode
  "<leader>hd" -- remember: help->dynamic
  function()
    if
      require("dynamic_help.extras.statusline").available() ~= "" -- check if help is available
    then
      require("dynamic_help").float_help(vim.fn.expand("<cword>")) -- open help
    else
      local help = vim.fn.input("Help Tag> ") -- get a help tag as user input
      require("dynamic_help").float_help(help) -- open help
    end
  end,
  {}
)

float-help

Statusline

Option Value

You can use this function to get the value of an option under the cursor:

return require("dynamic_help.extras.statusline").value()

option-value

Help Available

You can use this function to display a symbol if help is available:

return require("dynamic_help.extras.statusline").available()

help-available

Limitations

Not every help in a floating window will be perfect. This is because I get the text by just going through help files and storing all lines up to the next tag with a regex. So it can happen that some lines are missing.