Vim Tip: Save file with root permissions
Have you ever opened up a configuration file in vim and then after you do all your editing you realize you don’t have permissions to save?
A simple command that will re-open your current buffer with root permissions is this:
exe “%!sudo tee %” | e!
You can bind this in your vimrc and then never waste time editing a read-only file again!







