39

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

dlmeetei
  • 9,905
  • 3
  • 31
  • 38
isethi
  • 661
  • 1
  • 10
  • 22
  • 1
    You 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 Answers7

42

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.

Jimmy_Rw
  • 981
  • 9
  • 7
32

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
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
  • 4
    If 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
10

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

dlmeetei
  • 9,905
  • 3
  • 31
  • 38
5

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.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
SantaCruzRC
  • 67
  • 1
  • 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.

feli_x
  • 149
  • 1
  • 8
0

/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/>
-2

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.

Vincent
  • 2,073
  • 1
  • 17
  • 24