tags:

views:

659

answers:

3

I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing ":WQ" instead of ":wq" (on a German keyboard, you have to press shift to get the colon). Vim will then complain that 'W' is not an editor command.

Is there some way to make W and Q editor commands?

+9  A: 

Try

 :command WQ wq
 :command Wq wq
 :command W w
 :command Q q

This way you can define your own commands. See :help command for more information.

WMR
don't forget to add the above to your vimrc so you don't have to do it every time.
rampion
+3  A: 

And you can use

:cmap WQ wq

as well. E.g. I have

cmap h tab help

in my .vimrc which means opening help pages in a new tab.

Zsolt Botykai
Your `cmap h tab help` is not working for me
Andreas Grech
On which version if (G)Vim?What happens, when you type '<ESC>:cmap h tab help<CR>:h<SPACE>'?
Zsolt Botykai
A: 

I'm a former user of TextPad, and had memorized many of that program's accelerator keys. One of the first things I did in Vim was learning the map function to keep consistency (F5 search, F8 replace, etc.). I created my personal colorscheme, and borrowed alot from others' vimrc files. Viva Vim! Configurable to any degree.

wbogacz