Skip to content

Instantly share code, notes, and snippets.

@romainl
Last active September 8, 2022 06:09
Show Gist options
  • Save romainl/4e0f008824a29f47329ee14e96eba411 to your computer and use it in GitHub Desktop.
Save romainl/4e0f008824a29f47329ee14e96eba411 to your computer and use it in GitHub Desktop.
One way to set up MacVim for Python and Python 3 on MacOS (assuming Python and Python 3 were installed through MacPorts)
if toupper(substitute(system('uname'), '\n', '', '')) =~ 'DARWIN'
\ && exists('+pythonhome')
\ && exists('+pythondll')
\ && exists('+pythonthreehome')
\ && exists('+pythonthreedll')
let python_path = '/opt/local/Library/Frameworks/Python.framework/Versions'
let &pythonhome = ''
let &pythondll = ''
let &pythonthreehome = ''
let &pythonthreedll = ''
for i in range(0, 11)
if filereadable(python_path . '/2.' . i . '/lib/libpython2.' . i . '.dylib')
\ && &pythonhome == ''
\ && &pythondll == ''
let &pythonhome = python_path . '/2.' . i
let &pythondll = python_path . '/2.' . i . '/lib/libpython2.' . i . '.dylib'
endif
if filereadable(python_path . '/3.' . i . '/lib/libpython3.' . i . '.dylib')
\ && &pythonthreehome == ''
\ && &pythonthreedll == ''
let &pythonthreehome = python_path . '/3.' . i
let &pythonthreedll = python_path . '/3.' . i . '/lib/libpython3.' . i . '.dylib'
endif
endfor
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment