Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search vim help for subject under cursor

Tags:

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.

like image 267
Doug Richardson Avatar asked Apr 07 '13 20:04

Doug Richardson


People also ask

How to search in Vim help?

Searching for help topics :help {subject} (or just :h {subject} ) opens the help tag {subject} . {subject} can include wildcards like * , ? or [a-z] . If there are multiple help tags matching the given subject then when you press Enter Vim opens the “best” match.


2 Answers

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 
like image 183
Ingo Karkat Avatar answered Sep 21 '22 13:09

Ingo Karkat


The simplest solution is

nnoremap K :help <C-r><C-w><CR> 
like image 32
ZyX Avatar answered Sep 21 '22 13:09

ZyX