You can use the MYVIMRC
environment variable. This way, you won't have to pass -u
each time you fire up vim. (You can of course do an alias instead, but that won't help with e.g., vipw
)
Keep in mind that .vimrc
can execute arbitrary commands, if you use /home/user/.vimrc
you may be creating a security issue (e.g., someone manages to compromise your user account, changes your .vimrc, and then gets root the next time you edit a file as root). You can, of course, keep a known-safe copy in ~root/
somewhere.
You could assumably even set something up in ~root/.bashrc
to automatically set MYVIMRC
to something different for each different administrator.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…