Last Updated: October 12, 2018
·
703
· allysonbeckers

Forget to open vim with sudo? No problem.

If you already opened vim without sudo and made edits to a file for which you do not have write permissions, use this command to redeem yourself:

:w !sudo tee > /dev/null %

Source