Vim / Vi: Save File Without Root Permissions
Objective: You open a file for editing on vi
but you do not have write permissions for that file. You make changes and when you try to save changes, you get the infamous error “E212: Can’t open file for writing” from vim / vi editor. You realise that you forgot to execute vi
with sudo
. How do you save the file without creating a temporary file?