Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I have a file-watcher system which triggers some compilations upon time-stamp changes in the source file I am editing. I have the obsessive habit of using :w quite a few times during my editing session.
Is there a way to remap :w to :up ?
I had added below in my .vimrc earlier based on this post.
cnoreabbrev <expr> w getcmdtype() == ":" && getcmdline() == 'w' ? 'up' : 'w'
Alternatively, there is a plugin which does this too.
Hope this helps.
gecmdline() =~ '^w$'
Required, but never shown
1 year ago
11 months ago