Last Updated: February 25, 2016
· 0xnan

Less waste of time during the saving with VIM

When I use Vim, happens frequently that it doesn't save a document because there is the capslock enabled and Vim doesn't recognize the command ":W".
This is really a waste of time.
To workaround this you can just put at the end of your vimrc this code:

map :W :w

Now when you typing ":W" it's automatic translated in the valid command ":w".

4 Responses
Add your response


You should just map your caps lock key to control, and vice-versa. It will save you so much more time than this.

over 1 year ago ·

It's not about Caps Lock, I think. You type colon with Shift pressed. Sometimes you're so fast and press w sooner than Shift is released.

over 1 year ago ·

@ujovlado Oh yes this often happens!!
@jhiggins What is your solution?

over 1 year ago ·

Try mapping jj to exit insert mode and save your file with:

inoremap jj <Esc>:w<CR>

That way you can save your file while in insert mode with jj, or save while in normal mode with ijj.

Both are a lot faster than typing colon + w + hitting enter as your fingers barely have to leave the home keys.

over 1 year ago ·