:w !sudo tee %
w ! takes the file content and pipes it into the following shell command
sudo tee (the shell command) sudo opens tee as superuser and tee writes the input to a given parameter
% (the given parameter) is replaced with the current filename