我想设置系统范围的 vi 设置。
我知道我可以在 /etc/vimrc 和 ~/.vimrc 中为 vim 编辑器设置首选项
但我不认为我在 CentOS7 上的 vi 正在从 vimrc 文件或 /etc/virc 或 ~/.virc 等位置读取任何内容
戳POSIX:
Initialization in ex and vi
See Initialization in ex and vi for a description of ex and vi
initialization for the vi utility.
Run Code Online (Sandbox Code Playgroud)
手册页ex
说:
IEEE Std 1003.1-2001 does not mention system-wide ex and vi start-up
files. While they exist in several implementations of ex and vi, they
are not present in any implementations considered historical practice
by IEEE Std 1003.1-2001. Implementations that have such files should
use them only if they are owned by the real user ID or an appropriate
user (for example, root on UNIX systems) and if they are not writable
by any user other than their owner. System-wide start-up files should
be read before the EXINIT variable, $HOME/.exrc, or local .exrc files
are evaluated.
Run Code Online (Sandbox Code Playgroud)
所以我想/etc/exrc
是老派的最佳选择vi
。
但是,vi
在 CentOS 7 上可能只是vim-minimal
,在这种情况下,启动文件仍将使用vim
其名称:/etc/vimrc
或/etc/vim/vimrc
.