Alias :W to :w in Vim
If you ever type a bit to fast while saving a file, you might find yourself capitalizing that w. It's not trivial to alias a colon command in vim without side effects (like replacing all W's with w's). Fortunately ZyX on Stackoverflow has a solution
cnoreabbrev <expr> W ((getcmdtype() is# ':' && getcmdline() is# 'W')?('w'):('W'))
Written by Julian Simioni
Related protips
2 Responses
I'm using this for the same problem: map <C-S> :w<CR>
. This enables saving with Ctrl+S.
I'm also using map <C-Q> :qa!<CR>
.
I find these two very useful.
over 1 year ago
·
Very nice, but clearly it paves the way for all the evil of emacs to pour into our pure little vim paradise. :P
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#