I dislike the default way vim open the help window. I just want to open the help window vertically.

So I want to remap the help command to vert help.

What I put in vimrc is:

:noremap h vert h

But it doesn't work.


The mapping you defined works in normal, visual and operator-pending modes and does not automatically change modes. That is, when you type h, you effectively send to Vim the key sequence vert h, which enters visual mode (v), selects to the end of the current word (e), and replaces the visually-selected region (r) with the character t. Then, back in normal mode, the cursor is moved one position to the right () and one position to the left (h).

The mapping you want is this:

:nnoremap h :vert h<CR>

The colon (:) is a necessary part of the :vert command, putting Vim into ex mode before accepting the command. The <CR> terminates the command as you would if you had typed it.

I used :nnoremap rather than :noremap because it didn't seem useful to have this mapping work in any but the normal mode.


simply use cabbrev:

:cabbrev h vert h

when type :h, it will automatically expand to :vert h

  • There is a caveat with the solution, and that is any time you press h and then <space>, it will be expanded to "vert h". – EvergreenTree Oct 18 '15 at 16:39
  • it will only expand when I type in the command: h_, but it won't expand if type some other command which contain an h like: xxxh_, so it's perfect for my problem. – Aaron Shen Oct 23 '15 at 22:57
  • :cabbrev help vert help seems cleaner – jalanb Jun 4 '18 at 23:12

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