I usually work in a drop-down terminal, running about 25 characters high. Since I prefer tabs to windows1, usually a lot of horizontal space is wasted - around half of the terminal width.

On top of that, Vim, with the default setting of helpheight, leaves just about a couple of lines of the file content when I open a help window:

enter image description here

Is there a way to make :h use a vertical split?

I could:

  • decrease helpheight
  • use <C-W>L to manually move the window
  • make a map or a custom command which does the above for me.

Is there a simpler way?

1I do use windows when I need to look at multiple files together. But usually I prefer each file to be in its own (mental) context.


You can use :vert h [your topic] to open help vertically.

You can use the following command:

cnoreabbrev H vert h

To make vim replace H by vert h automatically in command line.

Also you can use this abbreviation:

cnoreabbrev HR vert bo h

To open the help window on the right side of the screen. (see :h :botright for more details on bo)

  • So, no configurable option? Something like splitright for :help?
    – muru
    Aug 22 '15 at 19:31
  • I'm not sure to understand what you mean, you'd prefer to be able to choose where the help window should be placed?
    – statox
    Aug 22 '15 at 19:35
  • I think you meant :rightbelow instead of :botright.
    – muru
    Aug 22 '15 at 21:26
  • 2
    Well it depends on the behavior you are expecting, let says that you should play with :lefta[bove], :rightb[elow], :to[pleft] and :bo[tright] and see which one you prefer. I prefer :botright over :rightbelow because what ever my layout is, I'll get a help windows of the full height of the screen. With :rightbelow is I already have an horizontal split my help window will be of the height of this split.
    – statox
    Aug 22 '15 at 22:01
  • 2
    Sadly, writing correct cabbrev commands involves some ritual. Aug 23 '15 at 11:21

This is inspired from junegunn 's vimrc:

augroup vimrc_help
  autocmd BufEnter *.txt if &buftype == 'help' | wincmd L | endif
augroup END
  • 1
    I'm curious: how does this differ from autocmd FileType help wincmd L? Any edge cases?
    – muru
    Aug 22 '15 at 21:28
  • I think that gets triggered twice, at least sometimes (try adding an echo there). It might be something to do with the help window opening, than going to the specific help tag. So, the BufEnter would be slightly more efficient. Not to mention adding a command that, when triggered twice, would become "undone" (cancel itself).
    – VanLaser
    Aug 22 '15 at 21:34

You can use a custom command that does the vertical-or-not selection for you. This can be based on the current window width and height :

function! s:ShowHelp(tag) abort
  if winheight('%') < winwidth('%')
    execute 'vertical help '.a:tag
    execute 'help '.a:tag

command! -nargs=1 H call s:ShowHelp(<f-args>)

References :

  • :h winheight
  • :h <f-args>
  • Excellent. This will be very useful for the times I have gvim open covering a vertical half of my screen.
    – muru
    Aug 22 '15 at 22:11

While this isn't a vertical split per-se, I find having help in its own tab to be very nice.

augroup HelpInTabs
   autocmd BufEnter *.txt call HelpInNewTab()
augroup END

Whoops. I thought I had pasted the whole answer. Here's the rest of the code.

" only apply to help files...
function! HelpInNewTab ()
  if &buftype == 'help'
    " convert help window to a tab
    execute "normal \<C-W>T"
  • 1
    That would be a good idea to also show what is your HelpInNewTab() function because I think this isn't a built-in feature so we can't really test your solution.
    – statox
    Aug 22 '15 at 20:41
  • " only apply to help files... function! HelpInNewTab () if &buftype == 'help' " convert help window to a tab execute "normal \<C-W>T" endif endfunction Mar 19 '18 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.