Reputation: 34170
After opening a file created by root in vim
, how to change the current user to superuser mode without quitting or before saving?
Upvotes: 15
Views: 5967
Reputation: 693
This should do the trick.
:w !sudo tee %
More tricks like that here: http://vim.wikia.com/wiki/Su-write
Upvotes: 36