8000 Fix python detection · python-mode/python-mode@ad90cfa · GitHub
[go: up one dir, main page]

Skip to content

Commit ad90cfa

Browse files
committed
Fix python detection
1 parent b92c982 commit ad90cfa

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

plugin/pymode.vim

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ filetype plugin on
1919
" OPTIONS: {{{
2020

2121
" Vim Python interpreter. Set to 'disable' for remove python features.
22-
call pymode#default('g:pymode_python', 'python')
22+
call pymode#default('g:pymode_python', '')
2323

2424
" Disable pymode warnings
2525
call pymode#default('g:pymode_warning', 1)
@@ -247,26 +247,46 @@ endif
247247
" Disable python-related functionality
248248
" let g:pymode_python = 'disable'
249249
" let g:pymode_python = 'python3'
250-
if g:pymode_python != 'disable' && (g:pymode_python == 'python3' || !has('python') && has('python3'))
251-
let g:pymode_python = 'python3'
252-
command! -nargs=1 PymodePython python3 <args>
253250

254-
elseif g:pymode_python != 'disable' && has('python')
255-
let g:pymode_python = 'python'
251+
" UltiSnips Fixes
252+
if !len(g:pymode_python)
253+
if exists('g:_uspy') && g:_uspy == ':py'
254+
let g:pymode_python = 'python'
255+
elseif exists('g:_uspy') && g:_uspy == ':py3'
256+
let g:pymode_python = 'python3'
257+
elseif has("python")
258+
let g:pymode_python = 'python'
259+
elseif has("python3")
260+
let g:pymode_python = 'python3'
261+
else
262+
let g:pymode_python = 'disable'
263+
endif
264+
endif
265+
266+
if g:pymode_python == 'python'
267+
256268
command! -nargs=1 PymodePython python <args>
269+
let g:UltiSnipsUsePythonVersion = 2
270+
271+
elseif g:pymode_python == 'python3'
272+
273+
command! -nargs=1 PymodePython python3 <args>
274+
let g:UltiSnipsUsePythonVersion = 3
257275

258276
else
259277

260278
let g:pymode_doc = 0
261279
let g:pymode_lint = 0
262280
let g:pymode_path = 0
263-
let g:pymode_python = 'disable'
264281
let g:pymode_rope = 0
265282
let g:pymode_run = 0
266283
let g:pymode_virtualenv = 0
267284

285+
command! -nargs=1 PymodePython echo <args>
286+
268287
endif
269288

289+
270290
command! PymodeVersion echomsg "Pymode version: " . g:pymode_version . " interpreter: " . g:pymode_python . " lint: " . g:pymode_lint . " rope: " . g:pymode_rope
271291

272292
augroup pymode

0 commit comments

Comments
 (0)
0