Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When using :help, it splits the window horizontally and opens the help in the top window. I then need to use ^w L to move the help window to the right. Same thing if use ^w f to open a file under the cursor, the window is split horizontally and the file is opened in the top window.

Is there a way to have these commands split the window vertically instead?

share|improve this question
up vote 4 down vote accepted

Vim provides these commands:

:vert[ical] {cmd}
    Execute {cmd}.  If it contains a command that splits a window,
    it will be split vertically.

:[count]winc[md] {arg}
    Like executing CTRL-W [count] {arg}.

Therefore:

  • To open a vertical help window type :vert help
  • To edit the file name under cursor in a new vertical split type :vert winc f
share|improve this answer

To open a file vertically, use :vsplit namefile, then you can use ^w l and ^w h to exchange between the opened files.

share|improve this answer

This moves the help window once. So you can freely move it around after the window is created.

if has('autocmd')
  function! ILikeHelpToTheRight()
    if !exists('w:help_is_moved') || w:help_is_moved != "right"
      wincmd L
      let w:help_is_moved = "right"
    endif
  endfunction

  augroup HelpPages
    autocmd FileType help nested call ILikeHelpToTheRight()
  augroup END
endif

The function, ILikeHelpToTheRight() will only run wincmd L once per window (it's what the w: prefix is for).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .