Vim: Possible to make default split vertical when opening help or file instead of horizontal?
Solution 1:
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
Solution 2:
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).