0

I have migrated from vim to nvim and everything seemed to work fine. I'm trying to figure out how to enable xdebug on nvim (it used to work fine before). So I ran to an issue when I tried to install this plugin: https://github.com/vim-scripts/DBGp-Remote-Debugger-Interface

When I try to install it using Vundle, I get this error

debugger.vim: Unable to find debugger.py. Place it in either your home vim directory or in the Vim runtime directory.

the thing is that the file does exist (my vim runtime path is ~/.vim):

~/.vim/bundle/DBGp-Remote-Debugger-Interface/plugin/debugger.vim
~/.vim/bundle/DBGp-Remote-Debugger-Interface/plugin/debugger.py

I even put a symlink on ~/.vim:

~/.vim $ ls -n
debugger.py -> bundle/DBGp-Remote-Debugger-Interface/plugin/debugger.py

still same error. What am I missing?

References

nvim health check output:

see this gist: https://gist.github.com/abbood/36788e9832f287e477d24567a9266a0d

my init.vim

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath=&runtimepath
source ~/.vimrc
let g:python3_host_prog='/Users/abdullah/.pyenv/shims/python3'
let g:python_host_prog='/Users/abdullah/.pyenv/shims/python'

update

After copying debugger.py to ~/.vim/plugin as suggested in the answer by Martin Turnoiji, it worked but now I'm getting this error:

Error detected while processing function provider#python#Call:
line   18:
Error invoking 'python_execute_file' on channel 3 (python3-script-host):
error caught in request handler 'python_execute_file ['/Users/abdullah/.vim/plugin/debugger.py', 1, 1]':
Traceback (most recent call last):
  File "/Users/abdullah/.pyenv/versions/3.6.3/lib/python3.6/site-packages/pynvim/plugin/script_host.py", line 108, in python_execute_file
    script = compile(f.read(), file_path, 'exec')
  File "/Users/abdullah/.vim/plugin/debugger.py", line 371
    print "exec does not supported by xdebug now."
                                                 ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(print "exec does not supported by xdebug now.")?
Error invoking 'python_execute' on channel 3 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'debugger_init' is not defined

this error is happening in this line. I'm guessing that it is being executed by python3 when it should be executed by python2. How can I instruct vim (or nvim) to specifically run this plugin using python2?

1

The paths this plugin checks are:

$VIMRUNTIME/plugin/debugger.py
$HOME/.vim/plugin/debugger.py
$VIM/vimfiles/plugin/debugger.py

See the source.

$VIMRUNTIME and $VIM are your Vim (or Neovim) install directory: /usr/local/share/vim/vim82 and /usr/local/share/vim respectively. Placing the script in ~/.vim/plugin should fix it.

This script hasn't been updated in ten years, and predates the rise in popularity of more modern Vim plugin management; back in the day you would just put these "scripts" in ~/.vim/plugin before pathogen came on the scene to manage the runtimepath.

0
0

this is more of a response to my own update (the original answer answers the original question perfectly so it's only fair it gets the correct answer).

neovim supports the ability to have multiple python versions using providers.

So I put this inside my init.vim file:

let g:python3_host_prog='/Users/abdullah/.pyenv/shims/python3'
let g:python_host_prog='/usr/bin/python2'

where i'm simply using my default python2 library that comes shipped with big sur.

That said, I got the error from my :checkHealth command that pynvim is not installed..

So I simply ran it against my python2 like so:

sudo python2 -m pip install pynvim

and it worked

Update

To make the debugger work with nvim I had to install xdebug 2 rather than xdebug 3, because it was clear that there was no current reliable plugin for vim that works with xdebug 3 (using either python 2 or 3).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.