Where Is the Default Vimrc Located on Mac

Where can I find the default vimrc on Mac when there is no ~/.vimrc. On some Linux its located in the /etc/vimrc

3

8 Answers

Type in Terminal: vim --version
as you want check the vim's version, then scroll down you will find something like; user vimrc file: "$HOME/.vimrc"

Hope it helps.

The path used by macOS's default vim install is /usr/share/vim/vimrc.

On my system at the moment (macOS 10.12.5), these are its contents:

" Configuration file for vim
set modelines=0     " CVE-2007-2438

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible    " Use Vim defaults instead of 100% vi compatibility
set backspace=2     " more powerful backspacing

" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
1

You can use :echo $MYVIMRC to print it. Also, you can have a look at :version which gives list of places being searched.

4

If you're just looking to change VIM defaults for your profile, macOS looks for ~/.vimrc, so if you make the file you can change your vim settings there.

For my homebrew generated vim the location of the default vimrc file is:

/usr/local/share/vim/vim81/defaults.vim

Here, the numbers 81 correspond to the vim version number.

I'm writing a whole new answer because I can't add a comment on SantaCruzRC's answer. I also didn't have that file by default. So just create a new .vimrc in home directory and add there any settings you want to have(e.g. syntax on).

If there is no .vimrc in the home directory you can create it.

1

On OSX Mojave, the default settings are at

/usr/share/vim/vim80/syntax/

If you want to modify any of these, it is best to copy the file you need into ~/.vim/syntax, and modify that, thereby preserving the original.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest