diff options
author | doy <doy@tozt.net> | 2009-01-04 20:35:17 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-01-04 20:35:17 -0500 |
commit | 98118aebeff0ab1f35f81904b0ba5854f4fbc002 (patch) | |
tree | 7090e1623fb3a45ce302885bac03d9e1b4fc5a03 /vimrc | |
parent | 0068c84d377dfc0361ca2f81738e114e49df4588 (diff) | |
download | conf-98118aebeff0ab1f35f81904b0ba5854f4fbc002.tar.gz conf-98118aebeff0ab1f35f81904b0ba5854f4fbc002.zip |
make K open a help-like buffer in vim rather than running man as an external program
Diffstat (limited to 'vimrc')
-rw-r--r-- | vimrc | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -450,6 +450,34 @@ endfunction nmap <silent> <Leader>p :call <SID>nopaste(0)<CR> vmap <silent> <Leader>p :<C-U>call <SID>nopaste(1)<CR> " }}} +" better version of keywordprg {{{ +function Help(visual, iskeyword, command) + let iskeyword = &iskeyword + for kw in a:iskeyword + exe 'set iskeyword+=' . kw + endfor + if a:visual + let oldreg = @a + normal `<"ay`>gv + let word = @a + let @a = oldreg + else + let word = expand('<cword>') + endif + let &iskeyword = iskeyword + exe &helpheight . 'new' + exe 'call ' . a:command . '("' . word . '")' + set bt=nofile + set nobuflisted +endfunction +function s:man(word) + exe 'read! man -P"col -b" ' . a:word + normal ggdd + set ft=man +endfunction +nmap <silent>K :call Help(0, [], '<SID>man')<CR> +vmap <silent>K :call Help(1, [], '<SID>man')<CR> +" }}} " Miscellaneous {{{ " have Y behave analogously to D rather than to dd nmap Y y$ |