Save a file as root from within vi
It happens to us all at some point: editing a file (usually a root-owned and writable file) under your own normal user account. More often than not, I only realize after I've made a bunch of changes.
:w !sudo tee %
Will save the file as the root user providing you can authenticate the sudo.