Where can I find the default vimrc on Mac when there is no ~/.vimrc
.
On some Linux its located in the /etc/vimrc
-
1You need to create it by yourself. Check this post: https://stackoverflow.com/questions/10921441/where-is-my-vimrc-file – FullStackDeveloper Jul 02 '17 at 03:14
-
1@CodePlayer the problem is without the the file I syntax highlighting and mouse select and other things are turned on. But when I create the ~/.vimrc file, it removes all the default config and uses the file config. ( I want to copy the default to the vimrc and modify as appropriate. – isethi Jul 02 '17 at 03:17
-
3`echo $MYVIMRC` or `:version` – dlmeetei Jul 02 '17 at 07:37
7 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.

- 981
- 9
- 7
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

- 51,713
- 20
- 123
- 112
-
4If you aren't using the default, here's the easiest way to discover where it is: `:scriptnames`. The first line should be the system `vimrc`. – Amadan Jul 03 '17 at 04:45
You can use :echo $MYVIMRC
to print it. Also, you can have a look at :version
which gives list of places being searched.

- 9,905
- 3
- 31
- 38
-
I tried all the paths that vim version gives but it shows nothing. Does vim automatically load a config within the binary if nothing is found? @dlmeetei – isethi Jul 02 '17 at 13:58
-
-
-
@isethi, Not sure if default is broken on Mac, People seems to prefer `macvim` on Mac – dlmeetei Jul 03 '17 at 08:54
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.

- 36,322
- 27
- 84
- 93

- 67
- 1
- 1
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.

- 149
- 1
- 8
/usr/local/lib/vim/doc/*.txt The Vim documentation files. Use ":help doc-file-list" to get the complete list.
/usr/local/lib/vim/doc/tags
The tags file used for finding information in the documentation files.
/usr/local/lib/vim/syntax/syntax.vim
System wide syntax initializations.
/usr/local/lib/vim/syntax/*.vim
Syntax files for various languages.
/usr/local/lib/vim/vimrc
System wide Vim initializations.
~/.vimrc Your personal Vim initializations.
/usr/local/lib/vim/gvimrc
System wide gvim initializations.
~/.gvimrc Your personal gvim initializations.
/usr/local/lib/vim/optwin.vim
Script used for the ":options" command, a nice way to view and set options.
/usr/local/lib/vim/menu.vim
System wide menu initializations for gvim.
/usr/local/lib/vim/bugreport.vim
Script to generate a bug report. See ":help bugs".
/usr/local/lib/vim/filetype.vim
Script to detect the type of a file by its name. See ":help 'filetype'".
/usr/local/lib/vim/scripts.vim
Script to detect the type of a file by its contents. See ":help 'filetype'".
/usr/local/lib/vim/print/*.ps
Files used for PostScript printing.
For recent info read the VIM home page:
<URL:http://www.vim.org/>

- 1
- 3
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.

- 2,073
- 1
- 17
- 24

- 321
- 3
- 3