Where is the rc file for vi editor.

vi

I would like to set up system-wide vi settings.

I know i can setup preferences for vim editor in /etc/vimrc and ~/.vimrc

but i don't think my vi on CentOS7 is reading anything from the vimrc files or locations such as /etc/virc or ~/.virc

Best Answer

Poking at POSIX:

Initialization in ex and vi
   See  Initialization  in  ex  and  vi  for  a  description  of ex and vi
   initialization for the vi utility.

And the manpage for ex says:

   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.

So I suppose /etc/exrc is your best bet for old-school vi.

However, vi on CentOS 7 is likely just vim-minimal, in which case the startup files will still be using vim in their name: /etc/vimrc or /etc/vim/vimrc.

Related Question