mirror of
https://github.com/gryf/pythonhelper.git
synced 2025-12-18 20:10:24 +01:00
Fix for selecting right interpreter for python3 enabled vim
This commit is contained in:
@@ -60,6 +60,8 @@ Changelog
|
|||||||
+---------+------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
+---------+------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| Version | Date | Author | Notes |
|
| Version | Date | Author | Notes |
|
||||||
+=========+============+================+===========================================================================================================================================================================================+
|
+=========+============+================+===========================================================================================================================================================================================+
|
||||||
|
| 1.1 | 2016-12-10 | Roman Dobosz | Fixed python3 enabled vim (without python2) |
|
||||||
|
+---------+------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| 1.0 | 2016-05-30 | Roman Dobosz | Rewrite python part (simplifying the code, clean it up, separate from vimscript, add some tests), make it Python3 compatible, lots of other changes |
|
| 1.0 | 2016-05-30 | Roman Dobosz | Rewrite python part (simplifying the code, clean it up, separate from vimscript, add some tests), make it Python3 compatible, lots of other changes |
|
||||||
+---------+------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
+---------+------------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||||
| | 2012-02-12 | cheater | `Several bug fixes`_, code cleanup, docs update |
|
| | 2012-02-12 | cheater | `Several bug fixes`_, code cleanup, docs update |
|
||||||
|
|||||||
@@ -1,28 +1,33 @@
|
|||||||
" File: pythonhelper.vim
|
" File: pythonhelper.vim
|
||||||
" Author: Michal Vitecek <fuf-at-mageo-dot-cz>
|
" Author: Michal Vitecek <fuf-at-mageo-dot-cz>
|
||||||
" Author: Roman Dobosz <gryf@vimja.com>
|
" Author: Roman Dobosz <gryf@vimja.com>
|
||||||
" Version: 1.0
|
" Version: 1.1
|
||||||
" License: 3-clause BSD license
|
" License: 3-clause BSD license
|
||||||
" Last Modified: 2016-05-24
|
" Last Modified: 2016-12-10
|
||||||
|
|
||||||
" VIM functions {{{
|
" VIM functions {{{
|
||||||
let g:pythonhelper_python = 'python'
|
|
||||||
let s:plugin_path = expand('<sfile>:p:h', 1)
|
let s:plugin_path = expand('<sfile>:p:h', 1)
|
||||||
|
|
||||||
function! s:PHLoader()
|
|
||||||
|
|
||||||
if !exists('g:pythonhelper_py_loaded')
|
function! s:SetPython(msg)
|
||||||
|
if !exists('g:_python')
|
||||||
if has('python')
|
if has('python')
|
||||||
exe 'pyfile ' . s:plugin_path . '/pythonhelper.py'
|
let g:_python = {'exec': 'python', 'file': 'pyfile'}
|
||||||
elseif has('python3')
|
elseif has('python3')
|
||||||
let g:pythonhelper_python = 'python3'
|
let g:_python = {'exec': 'python3', 'file': 'py3file'}
|
||||||
exe 'py3file ' . s:plugin_path . '/pythonhelper.py'
|
|
||||||
else
|
else
|
||||||
echohl WarningMsg|echomsg
|
echohl WarningMsg|echomsg a:msg|echohl None
|
||||||
\ "PythonHelper unavailable: "
|
|
||||||
\ "requires Vim with Python support"|echohl None
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:PHLoader()
|
||||||
|
if !exists('g:pythonhelper_py_loaded')
|
||||||
|
call s:SetPython("PythonHelper unavailable: "
|
||||||
|
\ "requires Vim with Python support")
|
||||||
|
execute g:_python['file'] . ' ' . s:plugin_path . '/pythonhelper.py'
|
||||||
let g:pythonhelper_py_loaded = 1
|
let g:pythonhelper_py_loaded = 1
|
||||||
else
|
else
|
||||||
echohl "already loaded"
|
echohl "already loaded"
|
||||||
@@ -42,7 +47,7 @@ function! PHCursorHold()
|
|||||||
|
|
||||||
" call Python function findTag() with the current buffer number and change
|
" call Python function findTag() with the current buffer number and change
|
||||||
" status indicator
|
" status indicator
|
||||||
execute g:pythonhelper_python . ' PythonHelper.find_tag(' . expand("<abuf>") .
|
execute g:_python['exec'] . ' PythonHelper.find_tag(' . expand("<abuf>") .
|
||||||
\ ', ' . b:changedtick . ')'
|
\ ', ' . b:changedtick . ')'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -55,7 +60,7 @@ function! PHBufferDelete()
|
|||||||
|
|
||||||
" call Python function deleteTags() with the current buffer number and
|
" call Python function deleteTags() with the current buffer number and
|
||||||
" change status indicator
|
" change status indicator
|
||||||
execute g:pythonhelper_python . ' PythonHelper.delete_tags(' . expand("<abuf>") . ')'
|
execute g:_python['exec'] . ' PythonHelper.delete_tags(' . expand("<abuf>") . ')'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user