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
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.
La 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
Autres conseils
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.