Wikia

Vim Tips Wiki

Using Gnu-info help in vim

Talk0
1,612pages on
this wiki
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)

ReferencesEdit

See alsoEdit

CommentsEdit

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)

Around Wikia's network

Random Wiki