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
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.
- 681
- 8
- 6
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
- 44,653
- 17
- 114
- 109
-
3If 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.
- 8,817
- 3
- 29
- 37
-
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.
- 35,848
- 27
- 79
- 88
- 49
- 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.
- 127
- 8
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).
- 21
- 4
If there is no .vimrc in the home directory you can create it.
- 103
- 4
-
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 09 '22 at 12:19
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,018
- 1
- 16
- 24
- 315
- 3
- 3