Skip to content

Issues 1 pythonx not supported #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions autoload/vim_block_party.vim
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
" Get a Python version to run with (Vim 8.0+ can just use `pythonx`)
if get(g:, 'expander_python_version', '2') == '2' && has('python')
let g:_uspy=":python "
elseif get(g:, 'expander_python_version', '3') == '3' && has('python3')
let g:_uspy=":python3 "
else
echoerr "No matching Python version could be found"
endif


function! vim_block_party#around_deep()
let l:block_party_temp_var = []

pythonx << EOF
from vim_textobj_block_party import party
party.around_deep('l:block_party_temp_var')
EOF
execute g:_uspy "from vim_textobj_block_party import party;party.around_deep('l:block_party_temp_var')"

if l:block_party_temp_var == []
return 0
Expand All @@ -17,10 +24,7 @@ endfunction
function! vim_block_party#around_deep_two_way()
let l:block_party_temp_var = []

pythonx << EOF
from vim_textobj_block_party import party
party.around_deep('l:block_party_temp_var', two_way=True)
EOF
execute g:_uspy "from vim_textobj_block_party import party;party.around_deep('l:block_party_temp_var', two_way=True)"

if l:block_party_temp_var == []
return 0
Expand All @@ -33,10 +37,7 @@ endfunction
function! vim_block_party#inside_deep()
let l:block_party_temp_var = []

pythonx << EOF
from vim_textobj_block_party import party
party.inside_deep('l:block_party_temp_var')
EOF
execute g:_uspy "from vim_textobj_block_party import party;party.inside_deep('l:block_party_temp_var')"

if l:block_party_temp_var == []
return 0
Expand All @@ -49,10 +50,7 @@ endfunction
function! vim_block_party#around_shallow()
let l:block_party_temp_var = []

pythonx << EOF
from vim_textobj_block_party import party
party.around_shallow('l:block_party_temp_var')
EOF
execute g:_uspy "from vim_textobj_block_party import party;party.around_shallow('l:block_party_temp_var')"

if len(l:block_party_temp_var) == 0
return 0
Expand All @@ -65,10 +63,7 @@ endfunction
function! vim_block_party#around_shallow_two_way()
let l:block_party_temp_var = []

pythonx << EOF
from vim_textobj_block_party import party
party.around_shallow('l:block_party_temp_var', two_way=True)
EOF
execute g:_uspy "from vim_textobj_block_party import party;party.around_shallow('l:block_party_temp_var', two_way=True)"

if l:block_party_temp_var == []
return 0
Expand All @@ -81,10 +76,7 @@ endfunction
function! vim_block_party#inside_shallow()
let l:block_party_temp_var = []

pythonx << EOF
from vim_textobj_block_party import party
party.inside_shallow('l:block_party_temp_var')
EOF
execute g:_uspy "from vim_textobj_block_party import party;party.inside_shallow('l:block_party_temp_var')"

if l:block_party_temp_var == []
return 0
Expand Down
20 changes: 16 additions & 4 deletions ftplugin/python/vim_block_party.vim
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
if !has('python') && !has('python3')
echoerr "vim-python-function-expander requires Python. Cannot continue loading this plugin"
finish
endif

if get(g:, 'block_party_loaded', '0') == '1'
finish
endif


" Get a Python version to run with (Vim 8.0+ can just use `pythonx`)
if get(g:, 'expander_python_version', '2') == '2' && has('python')
let g:_uspy=":python "
elseif get(g:, 'expander_python_version', '3') == '3' && has('python3')
let g:_uspy=":python3 "
else
echoerr "No matching Python version could be found"
endif


function! s:SetupBlockParty()
pythonx << EOF
from vim_textobj_block_party import environment
environment.init()
EOF
execute g:_uspy "from vim_textobj_block_party import environment;environment.init()"
endfunction


Expand Down
9 changes: 6 additions & 3 deletions pythonx/vim_textobj_block_party/block_party/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
from parso.python import tree
import parso
except ImportError:
# Use the provided parso library if the user doesn't have it installed.
from .vendors.parso.python import tree
from .vendors import parso
import sys
import os
from . import vendors
sys.path.append(os.path.dirname(vendors.__file__))
from parso.python import tree
import parso

# IMPORT LOCAL LIBRARIES
from . import config
Expand Down