Get Vim Help for Current Word
Some Vim users may be familiar with K
, which runs a program to lookup the keyword under the cursor. If not, try typing K
over puts
and watch the magic happen.
I wanted the same functionality for Vimscript keywords, so I added this mapping to my ~/.vimrc
:
nnoremap <F1> :help <C-r><C-w><CR>
This maps F1
(or your key of choice) to, basically, run 'help' followed by whatever word is under the cursor, in normal mode. After sourcing your configuration file, you can try it on nnoremap
— you should see the corresponding help page from map.txt
.