After opening a file in vim,And if that file is created by root .How to change the current user to superuser mode without quitting or before saving.
Thanks.
After opening a file in vim,And if that file is created by root .How to change the current user to superuser mode without quitting or before saving.
Thanks.
This should do the trick.
:w !sudo tee %
More tricks like that here: http://vim.wikia.com/wiki/Su-write