Just:
:w !sudo tee %
% is current file.
!sudo tee calls tee with administrator privileges and writes to current file. But not vi buffered file.
That’s why you will see a warning like this when using the command:
W12: Warning: File "/etc/myfile.txt" has changed and the buffer was changed in Vim as well
Thanks Mandus for this! I feel better now !