Vim: save a readonly file
Sometime you want to edit a file but you forgot to use sudo.
Here the solution :
Place this into your .vimrc
cmap w!! w !sudo tee % > /dev/null
Then when you want to save a readonly file just use
:w!!
Vim will ask your password and it's done !
Hope it's helpful
Written by Benjamin Lazarecki
Related protips
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#