Last Updated: June 16, 2016
·
368
· Zer0Knight

Open Vim Help in a new tab or a vertical split

Add some flexibility to :help with the ability to open it in a vertical split (as opposed to the usual horizontal split) or a new tab!

I've implemented it simply as two user commands:

" Open :help in a new tab
command! -nargs=? -complete=help Helptab tab help <args>
cnoreabbrev <expr> ht getcmdtype() == ':' && getcmdline() == 'ht' ? 'Helptab' :
'ht'

" Open :help in a vertical split
command! -nargs=? -complete=help Helpvert vert help <args>
cnoreabbrev <expr> hv getcmdtype() == ':' && getcmdline() == 'hv' ? 'Helpvert' :
'hv'
cnoreabbrev <expr> vh getcmdtype() == ':' && getcmdline() == 'vh' ? 'Helpvert' :
'vh'

The cabbrev allows you to use :ht or :hv (or :vh if your brain is wired that way :P) as a shortcut, but will not trample on arbitrary commands containing (ht|hv|vh). Credit to this SO post for that safety trick.

Pretty simple, but I love it. Hopefully you do too :)