cmap w!! %!sudo tee > /dev/null %
Using a cmap for this means that every press to a w lags for a full second while Vim waits on the rest of the map. Even after I figured out what was going on, this was pretty disorienting.
The proper way to achieve this involves creating a :command. This would involve changing the interface to something like :SudoW (unfortunate, but not a tragedy in my book.) Two suggestions:
eunuch.vim and, for that matter, basically every other @tpope plugin ever.
Hey @tpope eunuch.vim looks quite nice to me, actually this mapping is a plain copy/paste from my own config and I haven't noticed the delay because honestly I am used to it, been using it for years now, nice catch!
Mind pushing a pull request to add eunuch.vim that closes this issue?
Add tpope's eunuch plugin
Looks like you beat me to it!
Yea I feel in a giving mode this morning Ha! :)
Really closes #484.
to avoid the delay you could use:
ca w!! w !sudo tee % >/dev/null