Question

While working with some Vim scripts, I found myself typing

:help {subject}

quite a bit. I want CTRL+] (jump to definition of keyword under cursor) functionality, but instead of running :tag {ident} I want it to do :help {subject}, where {subject} is the word under the cursor.

Was it helpful?

Solution

Just press K. If you have set a global 'keywordprg', you need to unset it (or set it to the special :help value) in ~/.vim/after/ftplugin/vim.vim:

:setlocal keywordprg=:help

OTHER TIPS

The simplest solution is

nnoremap K :help <C-r><C-w><CR>

To check the documentation of the keyword under your cursor, you can press Ctrl+] to go to its documentation.

If you have enable mouse support in nvim with the following options:

set mouse=a

you can double click the keyword to go to its documentation.

By the way, to go back to previous position in the help file, press Ctrl+O or Ctrl+T.

The above is also true for Neovim.

References

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top