I'm trying to get into the habit of editing root-owned files with sudoedit
, instead of sudo vim
. This has a few advantages, one of which is that it uses my user's ~/.vimrc
.
Is there an equivalent, instead of using sudo vimdiff
?
What I've tried
- Instead of using
vimdiff
directly, one can open two files in vertical splits, then run:diffthis
in both. However, if I open up one file withsudoedit
, then I'd have to open the second file directly, instead ofsudoedit
automatically creating a copy of this file in/var/tmp
. - One can also open files directly in splits using
vim -O file1 file2
. However, unsurprisingly,sudoedit -O
fails.
~/.bashrc
:alias sudovimdiff='SUDO_EDITOR=vimdiff sudoedit'
. – Sparhawk Feb 25 '15 at 01:14