lyuts / vim-rtags

Vim bindings for rtags, llvm/clang based c++ code indexer.
BSD 2-Clause "Simplified" License
282 stars 56 forks source link

Bring back Python 3 compatibility #90

Closed sergei-dyshel closed 6 years ago

sergei-dyshel commented 6 years ago

AFAIU https://github.com/lyuts/vim-rtags/commit/e92265dd1a22d73da06236135bf948832fe6ee7d changes required python version to 2. I understand that this is preferred setting for most users, but not for all them. Since it's not possible to use both python 2 and 3 simultaneously in vim, many python version-agnostic plugins try to autodetect used version and I believe that this is the proper way.

woky commented 6 years ago

Vim in Debian testing is compiled with Python 3 support only.

$ vim
Error detected while processing function rtags#InitPython:
line    1:
E319: Sorry, the command is not available in this version: python << endpython
line    2:
E492: Not an editor command: import vim
line    4:
E488: Trailing characters: script_folder = vim.eval('s:script_folder_path')
line    5:
E492: Not an editor command: sys.path.insert(0, script_folder)
line    7:
E492: Not an editor command: import vimrtags
line    9:
E492: Not an editor command: endpython
Press ENTER or type command to continue
lyuts commented 6 years ago

I see, that's a good point. I'll put it on my list to see which python is available and which support vim is built with. My apologies for this inconvenience.

lyuts commented 6 years ago

Hey guys, I made a change to try and detect which python version is available. Can you try it? It is in py_2_and_3 branch (commit: 8773238).

rajukv commented 6 years ago

Hi,

I switched to this branch and I am seeing the following errors:

Error detected while processing ~/.vim/plugged/vim-rtags/plugin/rtags.vim: line 16: E121: Undefined variable: output E15: Invalid expression: "[vim-rtags] Vim is missing python support" . output | echohl None Error detected while processing function rtags#InitPython: line 7: E121: Undefined variable: g:rtagsPy E15: Invalid expression: g:rtagsPy." ".s:pyInitScript

This is with vim from debian sid

bartlibert commented 6 years ago

I tried it with vim from debian testing (buster) and I don't get the error above, but there is another error, which is related to pyeval, which is not available either, it should be py3eval for vim with python3.

Update: I cleared my plugin cache and tried again, now everything seems ok.

sergei-dyshel commented 6 years ago

I'm using my own Vim built with python3-only support and this branch works for me.

lyuts commented 6 years ago

Can you guys confirm you don't see this issue anymore? If so, I'd resolve this issue.

bartlibert commented 6 years ago

For me it's working. I've been using the plugin successfully for several weeks now.

lyuts commented 6 years ago

I think this has been addressed by c177551. Resolving this one.