Modify a file you opened with vim without the proper access rights.
:w !sudo tee %
or if you don't even want to recall it, map it in your vim's config file :
cmap w!! %!sudo tee > /dev/null %
Written by Arnaud ASSAD
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#