Skip to content
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

Add Python 3 support #28

Open
sscherfke opened this issue Jan 30, 2015 · 1 comment
Open

Add Python 3 support #28

sscherfke opened this issue Jan 30, 2015 · 1 comment

Comments

@sscherfke
Copy link
Contributor

The homebrewed MacVim can only be installed with either Python 2 *or 3 support, but not both. So I enabled Python 3 support and noticed that splice.vim does not work with Python 3.

I think it is “relatively” easy to support both versions. The Python code looks relatively compatible with both versions. Maybe you have to fix the relative-import thing introduced with Python 3.3(?). You also need to modify autoload/splice.vim as followed (inspired by the python-mode plug-in which supports both Python versions). You basically define aliases for pyfile and python depending on the Python version and use them instead of the orginal commands:

" [...]

" Python version check {{{

if has('python')
    let s:has_supported_python = 2
python << ENDPYTHON
import sys, vim
if sys.version_info[:2] < (2, 5):
    vim.command('let s:has_supported_python = 0')
ENDPYTHON
    " Define aliases to pyfile and python
    let s:splice_pyfile = 'pyfile'
    command! -nargs=1 SplicePython python <args>
elseif has('python3')
    let s:has_supported_python = 3
    " Define aliases to py3file and python3
    let s:splice_pyfile = 'py3file'
    command! -nargs=1 SplicePython python3 <args>
else
    let s:has_supported_python = 0
endif
" [...]

" Wrappers {{{

function! splice#SpliceInit() "{{{
    let python_module = fnameescape(globpath(&runtimepath, 'autoload/splice.py'))
    exe s:splice_pyfile . ' ' . python_module
    SplicePython SpliceInit()
endfunction "}}}

" [...]

" }}}

Please let me now if I can help you (e.g., with testing).

Splice.vim is awesome. Thanks! :-)

@sscherfke
Copy link
Contributor Author

I created a pull request over at bitbucket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant