Vim
is my preferred text editor when I program, and thus I always run into a particularly annoying issue.
Frequently, when I quickly need to save the buffer and continue on to some other miscellaneous task, I do the typical
:w
However, I – what seems to be like more than 50% of the time – always manage to capitalise that :w
. Naturally, vim yells at me because W
is an invalid command
E492: Not an editor command: W
My question is how can one alias colon-commands in vim. Particularly, could you exemplify how to alias W
to w
.
I am aware of the process to map keys to certain commands. Unfortunately, that is not what I'm looking for.
Maybe you would like to map one of your function keys (F1..F12) to :w ? Then put this into your .vimrc:
(ctrl-o in insert mode switches temporarily to normal mode).