A lot of times, when I want to save a file in vim and immediately exit thereafter, I accidentally type :Wq instead of :wq.
Vim naturally gives me this error:
E492: Not an editor command: Wq
I'm wondering, is it possible to remap :Wq to :wq?
You can create a simple vim command that is basically an alias for wq
. Place the following in your ~/.vimrc
file:
command! Wq wq
For more help see:
:h :command
You can also use ZZ
which is the same as :wq<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With