Is there a way in vim to make :W to do the same thing as :w?

vim

Solution

The hack is via a `:cmap` or `:cabb`, but these have side effects (i.e. other instances will be inadvertently converted, too).

The cmdalias plugin does this better.

But I think for your use case it's best to define your own uppercase command-variants. The main challenge is to support all the options that the original one has:

command! -bang -range=% -complete=file -nargs=* W <line1>,<line2>write<bang> <args>
command! -bang Q quit<bang>

Problem

The same goes for :q and :Q. I almost always don't let up on shift quick enough and seeing that :Q and :W aren't used anyway I thought it would be nice to just have them do the same as their lower-case counterparts.

Original source