Last Updated: November 19, 2020
·
15.44K
· iltempo

Map :W to :w in vim

One of the most annoying things about vim for me was that I frequently typed :W instead of :w. This is happens because the colon needs a shift, w doesn't.

So I mapped some commands in my .vimrc:

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

Now if I am writing uppercase letters for that commands, the lower case commands will be executed.

Source: http://stackoverflow.com/questions/117150/can-i-re-map-commands-in-vim

Related protips:

Basic Vim commands - For getting started

5 Responses
Add your response

I used to do this, but then I decided to nnoremap ; :

It seems silly, but once you try it for a bit, you won't know how you lived without it!

over 1 year ago ·

you changed my life forever matt, marry me.

over 1 year ago ·

:x

It makes :wq even shorter.

over 1 year ago ·

Or just type ZZ in normal mode

over 1 year ago ·

It worked! F-yeah!

over 1 year ago ·