Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
701 views
in Technique[技术] by (71.8m points)

vim - How to reference/source a custom .vimrc file

Is there a way to reference (or "source") another user's .vimrc file?

When I kuu (a variant of su that uses kerberos security tokens) to an admin user ID, I would like to use my personal .vimrc file.

I don't want to overwrite the admin's existing .vimrc file because the admin ID is shared by multiple users.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...