50

Right now, I make everyone do ~/.vimrc and put their settings there.

How can I make a global, default .vimrc for new users?

030
  • 5,731
  • 12
  • 61
  • 107
Alex
  • 8,111
  • 24
  • 71
  • 99

6 Answers6

60

usually by creating /etc/vimrc or /etc/vim/vimrc. Depends on your version of vim and linux/unix

ennuikiller
  • 828
  • 8
  • 8
15

to create a default ~/.vimrc for all new users, you should be able to drop it into /etc/skel

If I recall correctly, that provides the template for new user's home directories.

James Maroney
  • 311
  • 1
  • 5
10

In Debian, it appears the file you are looking for is:

/etc/vim/vimrc

It might be different in a different distro (though I think that is not much likely).

Good luck.

user24524
  • 441
  • 4
  • 8
9

See :help system-vimrc:

For Unix, MS-DOS, MS-Windows, OS/2, VMS, Macintosh, RISC-OS and Amiga the system vimrc file is read for initializations. The path of this file is shown with the ":version" command. Mostly it's "$VIM/vimrc". Note that this file is ALWAYS read in 'compatible' mode, since the automatic resetting of 'compatible' is only done later. Add a ":set nocp" command if you like.

So, put your system configurations in this file. Type :help version in vim to see where, or echo $VIM at the shell to see if $VIM is defined. (Note that you may have to set $VIM for all users, such as in a system bashrc file.)

Ether
  • 322
  • 3
  • 12
0

Vim appears to have changed to loading a defaults.vim file last in the absence of ~/.vimrc. Until this is addressed, I figured I need to load defaults.vim in /etc/vim/vimrc.local the way a sample vimrc_example.vim shows, set a flag to prevent the automatic loading of defaults.vim last and then set own preferences in the same file.

 " Get the defaults that most users want.
 source $VIMRUNTIME/defaults.vim
+let g:skip_defaults_vim = 1

https://github.com/vim/vim/issues/2917#issuecomment-631908139

eel ghEEz
  • 113
  • 4
0

for MacVim, it's at /usr/local/Cellar/macvim/7.4-98/MacVim.app/Contents/Resources/vim/vimrc

pambda
  • 111
  • 2