If you have opened a file in vim as non root user but you want to save the changes as root user.


:w !sudo tee %