16 févr. 2014

Don't sudo vim

Each time you attempt to perform a sudo vim, you end up into the configuration of root. Therefore, you loose some of your personal plugins that requires local commands. That, and a warning message.

There are different ways of achieving a proper  sudo vim (providing a new $HOME via -H or using your /etc/sudoers), but still, there are situations when you have forgotten to use sudo and you end up stuck with a file that you can't overwrite.

My preferred move is to completely avoid using sudo vim and simply hit the following command whenever I need a proper right upgrade:
:w !sudo tee %