Created
April 3, 2012 06:23
-
-
Save xuhdev/2289746 to your computer and use it in GitHub Desktop.
A vimL function that finds python interpreter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Find python interp. If found, return python command; if not found, return '' | |
function! FindPythonInterp() | |
if has('unix') | |
let l:searching_list = [ | |
\ 'python', | |
\ 'python27', | |
\ 'python26', | |
\ 'python25', | |
\ 'python24', | |
\ '/usr/local/bin/python', | |
\ '/usr/local/bin/python27', | |
\ '/usr/local/bin/python26', | |
\ '/usr/local/bin/python25', | |
\ '/usr/local/bin/python24', | |
\ '/usr/bin/python', | |
\ '/usr/bin/python27', | |
\ '/usr/bin/python26', | |
\ '/usr/bin/python25', | |
\ '/usr/bin/python24'] | |
elseif has('win32') | |
let l:searching_list = [ | |
\ 'python', | |
\ 'python27', | |
\ 'python26', | |
\ 'python25', | |
\ 'python24', | |
\ 'C:\Python27\python.exe', | |
\ 'C:\Python26\python.exe', | |
\ 'C:\Python25\python.exe', | |
\ 'C:\Python24\python.exe'] | |
endif | |
for possible_python_interp in l:searching_list | |
if executable(possible_python_interp) | |
return possible_python_interp | |
endif | |
endfor | |
return '' | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment