Vim Tips Wiki

Using Gnu-info help in vim

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 36 Printable Monobook Previous Next

created 2001 · complexity basic · author vimer · version 5.7

K in normal bring you the man page about the keyword under current cursor.

:nnoremap <F1> :exe ":!info ".expand("<cword>")

Now press F1 while the cursor is hold by a keyword such as printf will bring you to Gnu-info help page.

The word should be escaped before passing it on to the shell. Using Vim 7.2 or later, this is simple:

:nnoremap <F1> :exe ":!info ".shellescape(expand('<cword>'), 1)


See alsoEdit


Far better to use Info browsing within Vim.

Then e.g. :nnoremap <F1> :exe ":Info ".expand("<cword>")<CR>

Also, set your shell to alias info to use vim: (bash)

function viminfo () { vim -c "Info $1" -c "bdelete 1"; }
alias info=viminfo

Another choice is simply to change the 'keywordprg' option to info. Then K will invoke info instead of man.

-- JamesVega 17:39, February 9, 2010 (UTC)

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki