Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

up vote 2 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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