It is not advisable to use sudo
with a graphical application like gedit
, as described at this link. Accordingly, I have tended to use vim
with sudo
.
Recently I noticed my ~/.viminfo
was owned by root on a fairly fresh install of Ubuntu 16.04 (Xenial Xerus), so it had me wondering if even Vim is considered to be graphical or if there is some other problem with invoking sudo vim
. After changing ownership to myself via:
sudo find $HOME -not -user $USER -exec chown $USER:$(id -g) {} +
and subsequently running sudo vim
I was unable to have ~/.viminfo
owned by root. However, I am certain that it recently was owned by root.
Is it inadvisable to invoke sudo vim
?
:w !sudo tee %