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

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

migrated from stackoverflow.com Nov 8 '09 at 4:10

This question came from our site for professional and enthusiast programmers.

up vote 51 down vote accepted

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

  • I am using CentOS – Alex Nov 1 '09 at 2:12
  • 7
    should be /etc/vimrc on CentOs – ennuikiller Nov 1 '09 at 2:16
  • 1
    It is /etc/vimrc – Alex Nov 1 '09 at 2:21
  • Doesn't work on Solaris – majkinetor Nov 15 '16 at 12:22
  • 2
    I'd personally suggest /etc/vim/vimrc.local, at least on Ubuntu 16. It gets sourced by /etc/vim/vimrc and means you don't have to hack at the default file. – Matt Fletcher Jan 31 at 11:25

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.

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.

  • 7
    By default it sources /etc/vim/vimrc.local which would be safer for updates – vvondra Nov 5 '15 at 14:05

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.)

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

protected by Sven Feb 4 '17 at 12:44

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.