Skip to content

Instantly share code, notes, and snippets.

@settipalli
Created May 17, 2012 08:37
Show Gist options
  • Save settipalli/2717426 to your computer and use it in GitHub Desktop.
Save settipalli/2717426 to your computer and use it in GitHub Desktop.
Save a file with root permissions from within VIM
This trick will help when you open a file using normal user and then realize that you need to be root to save the file:
In command mode:
:w !sudo tee %
Ref: http://stackoverflow.com/questions/1005/getting-root-permissions-on-a-file-inside-of-vi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment