For me personally the advantage is that since the editor is opened by your user, it has all of the same config that I’m used to (such as my souped up Neovim config).
Whereas if you sudo nvim /path/to/file then the editor is opened as root and you don’t have the same configuration.
I just make /root/.config/nvim a symlink to ~/.config/nvim and running nvim as root gives me all the same settings I’m used to. (I’d rather not run nvim-qt as root though, so in that case sudoedit is useful.)
For me personally the advantage is that since the editor is opened by your user, it has all of the same config that I’m used to (such as my souped up Neovim config).
Whereas if you
sudo nvim /path/to/file
then the editor is opened as root and you don’t have the same configuration.That’s a pretty big advantage actually. Thanks!
I just make
/root/.config/nvim
a symlink to~/.config/nvim
and runningnvim
as root gives me all the same settings I’m used to. (I’d rather not runnvim-qt
as root though, so in that casesudoedit
is useful.)