Save Readonly file in Vim
You finish editing a file in Vim and are about to save it, but realize it's a readonly file which does not allow writing without sudo. So how to save it without quitting Vim? Try the following command
:w ! sudo tee % > /dev/null
Written by Leo Zhang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#