如何引用/获取自定义 .vimrc 文件 [英] How to reference/source a custom .vimrc file

查看:35
本文介绍了如何引用/获取自定义 .vimrc 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法引用(或来源")另一个用户的 .vimrc 文件?

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

当我将 kuu(使用 kerberos 安全令牌的 su 的变体)转换为管理员用户 ID 时,我想使用我的个人 .vimrc 文件.

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.

我不想覆盖管理员现有的 .vimrc 文件,因为管理员 ID 被多个用户共享.

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

推荐答案

您可以使用 MYVIMRC 环境变量.这样,每次启动 vim 时就不必传递 -u.(您当然可以改用别名,但这对例如 vipw 没有帮助)

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)

请记住,.vimrc 可以执行任意命令,如果您使用 /home/user/.vimrc,您可能会产生安全问题(例如,有人管理破坏您的用户帐户,更改您的 .vimrc,然后在您下次以 root 身份编辑文件时获得 root 权限).当然,您可以在 ~root/ 的某处保留一个已知安全的副本.

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.

您甚至可以在 ~root/.bashrc 中设置一些东西,以便为每个不同的管理员自动设置 MYVIMRC 为不同的东西.

You could assumably even set something up in ~root/.bashrc to automatically set MYVIMRC to something different for each different administrator.

这篇关于如何引用/获取自定义 .vimrc 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆