Skip to content

Commit e3e3a15

Browse files
committed
Set pythonhome and pythonthreehome automatically
MacVim uses Homebrew python2 if installed, otherwise System's MacVim uses Homebrew python3 if installed, next try to use python.org binary
1 parent 16974f8 commit e3e3a15

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

runtime/doc/options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5929,6 +5929,7 @@ A jump table for the options with a short description can be found at |Q_op|.
59295929
{not in Vi}
59305930
{only available when compiled with the |+python/dyn|
59315931
feature}
5932+
Note: EXPERIMENTAL. It may be changed or removed in the future.
59325933
Specifies the name of the Python 2.x home directory. When 'pythonhome'
59335934
and the PYTHONHOME environment variable are not set, PYTHON_HOME,
59345935
which was specified at compile time, will be used for the Python 2.x
@@ -5955,6 +5956,7 @@ A jump table for the options with a short description can be found at |Q_op|.
59555956
{not in Vi}
59565957
{only available when compiled with the |+python3/dyn|
59575958
feature}
5959+
Note: EXPERIMENTAL. It may be changed or removed in the future.
59585960
Specifies the name of the Python 3 home directory. When
59595961
'pythonthreehome' and the PYTHONHOME environment variable are not set,
59605962
PYTHON3_HOME, which was specified at compile time, will be used for

src/MacVim/vimrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,25 @@ set backspace+=indent,eol,start
1313
" the entire MacVim menu is set up in a nib file which currently only is
1414
" translated to English).
1515
set langmenu=none
16+
17+
" Python2
18+
" MacVim uses Homebrew python2 if installed, otherwise configured one
19+
if exists("&pythondll") && exists("&pythonhome")
20+
if filereadable("/usr/local/Frameworks/Python.framework/Versions/2.7/Python")
21+
" Homebrew python 2.7
22+
set pythondll=/usr/local/Frameworks/Python.framework/Versions/2.7/Python
23+
set pythonhome=/usr/local/Frameworks/Python.framework/Versions/2.7
24+
endif
25+
endif
26+
27+
" Python3
28+
" MacVim uses Homebrew python3 if installed, next try to use python.org binary
29+
if exists("&pythonthreedll") && exists("&pythonthreehome") &&
30+
\ !filereadable(&pythonthreedll)
31+
if filereadable("/Library/Frameworks/Python.framework/Versions/3.5/Python")
32+
" https://www.python.org/downloads/mac-osx/
33+
set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.5/Python
34+
set pythonthreehome=/Library/Frameworks/Python.framework/Versions/3.5
35+
endif
36+
endif
37+

0 commit comments

Comments
 (0)