" System vimrc file for MacVim
"
" Author:       Bjorn Winckler <bjorn.winckler@gmail.com>
" Maintainer:   macvim-dev (https://github.com/macvim-dev)

set nocompatible

" The default for 'backspace' is very confusing to new users, so change it to a
" more sensible value.  Add "set backspace&" to your ~/.vimrc to reset it.
set backspace+=indent,eol,start

" Python2
" MacVim is configured by default in the binary release to use the
" pre-installed System python2 version. However, following code tries to
" find a Homebrew, MacPorts or an installation from python.org:
if exists("&pythondll") && exists("&pythonhome")
  " Homebrew python 2.7
  if filereadable("/usr/local/Frameworks/Python.framework/Versions/2.7/Python")
    set pythondll=/usr/local/Frameworks/Python.framework/Versions/2.7/Python

  " MacPorts python 2.7
  elseif filereadable("/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python")
    set pythondll=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python

  " https://www.python.org/downloads/mac-osx/
  elseif filereadable("/Library/Frameworks/Python.framework/Versions/2.7/Python")
    set pythondll=/Library/Frameworks/Python.framework/Versions/2.7/Python
  endif
endif

" Python3
" MacVim is configured by default in the binary release to set
" pythonthreedll to Homebrew python3. If it cannot be found, the following
" code tries to find Python3 from other popular locations.  Note that we are
" using "Current" for the version, because Vim supports the stable ABI and
" therefore any new version of Python3 will work.
if exists("&pythonthreedll") && exists("&pythonthreehome") &&
      \ !filereadable(&pythonthreedll)
  " MacPorts python
  if filereadable("/opt/local/Library/Frameworks/Python.framework/Versions/Current/Python")
    set pythonthreedll=/opt/local/Library/Frameworks/Python.framework/Versions/Current/Python

  " macOS default Python, installed by 'xcode-select --install'
  elseif filereadable("/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/Current/Python3")
    set pythonthreedll=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/Current/Python3

  " https://www.python.org/downloads/mac-osx/
  elseif filereadable("/Library/Frameworks/Python.framework/Versions/Current/Python")
    set pythonthreedll=/Library/Frameworks/Python.framework/Versions/Current/Python
  endif
endif

" vim: sw=2 ts=2 et
