Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening Vim help in a vertical split window

Tags:

vim

:vertical (vert) works:

:vert help

You can also control whether the window splits on the left/top or the right/bottom with topleft (to) and botright (bo). For example, to open help in the right window of a vertical split:

:vert bo help

As an alternative to Haroogan and Sean's answers you can use the FileType event for the autocommand like this:

autocmd FileType help wincmd L

Although this will change the position of any help window as well as moving the window after manually placing it if the file you are looking at changes. But I believe that this is a problem with any solution.


No need to remap any commands or introduce weird aliases like :Help. Here is the solution. Create ~/.vim/after/ftplugin/help.vim where you can override any Vim settings particularly for help and add the following line there:

autocmd BufWinEnter <buffer> wincmd L

This hook will ensure that any help file is opened in vertical split. Furthermore, it does not have a side effect described in Sean's answer. Personally, this is perfect solution for me so far.

Hope this helps. Best of luck.


This command should do it:

:vert help

Put this in your .vimrc:

command -nargs=* -complete=help Help vertical belowright help <args>

Now you can open a vertical help with the :Help command (notice that the first-letter is uppercase)