How to properly install pyclewn for VIM?

左心房为你撑大大i 提交于 2019-12-23 04:24:37

问题


I am interested in improving my workflow, and was hoping to add clewn or pyclewn so I could do debugging in vim. I am using Mac OS X 10.8. Unfortunately, I can't seem to get it installed with the basic instructions. I run the instuctions on this page: http://pyclewn.sourceforge.net/install.html https://sourceforge.net/projects/pyclewn/

mbp:pyclewn-1.10.py2 nate$ python setup.py install --force
Failed to run 'gvim' as Vim.
Please set the EDITOR environment variable or run 'pyclewn --editor=/path/to/(g)vim'.

Traceback (most recent call last):
  File "setup.py", line 48, in <module>
    vimdir = pyclewn_install.vimdir()
  File "/Users/nate/Downloads/pyclewn-1.10.py2/clewn/misc.py", line 85, in _dec
ret = f(*args)
  File "/Users/nate/Downloads/pyclewn-1.10.py2/pyclewn_install.py", line 49, in vimdir
    path = vim.exec_vimcmd(['echon $VIM'])
  File "/Users/nate/Downloads/pyclewn-1.10.py2/clewn/vim.py", line 96, in exec_vimcmd
subprocess.Popen(args).wait()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

I try to do as it suggests by setting the EDITOR variable:

mbp:pyclewn-1.10.py2 nate$ EDITOR=/usr/bin/vim
mbp:pyclewn-1.10.py2 nate$ echo $EDITOR
/usr/bin/vim

...But I get the same error again. I get the same error if I try to use the Python 3 version of pyclewn as well.

Trying to run the other suggested command gives another error:

mbp:pyclewn-1.10.py2 nate$ ./pyclewn --editor=/usr/bin/vim
vim  CRITICAL 
Exception in pyclewn:

<class 'clewn.ClewnError'>
"pyclewn.vim version does not match pyclewn's:
    pyclewn version: "pyclewn-1.10.py2"
    pyclewn.vim version: """
source line: "% (pyclewn_version, version))"
at /Users/nate/Downloads/pyclewn-1.10.py2/clewn/vim.py:383
pyclewn aborting...

Any ideas? I don't know enough about this kind of stuff to help fix it, unfortunately. The project is hosted on sourceforge, and I can't figure out how to report a bug there, so I'm posting here.


回答1:


As usual, I am an idiot. Having not exported the EDITOR variable, it was invisible to the python script. So, for those of you that have this error, you need to do:

$ EDITOR=/usr/bin/vim
$ echo $EDITOR
/usr/bin/vim
$ export EDITOR

For me it seems that my version of vim does have netbeans_intg and autocmd support (required for pyclewn). It does not have python3 support. You can figure this out by typing vim --version. I am not sure if at some point in the past I replaced the version of vim that comes with OS X, or if that is how it comes now. I don't know why I would have modified/replaced the /usr/bin/ version, so I assume it is now standard that way. Hopefully this works for others.




回答2:


I have no practical experience with pyclewn but a few things are relatively obvious from your question:

  • You are using the default Vim that comes with Mac OS X. AFAIK, it doesn't come either with Python support or with the netbeans interface. Basically, there's no way to get a working pyclewn install (let alone a convincing editing environment) that way. I'd suggest you get a proper Vim build like MacVim which, AFAIK, comes with all you need. Assuming you have moved the bundled mvim script somewhere in your $PATH, you'll probably be able to run pyclewn --editor=/path/to/mvim.

  • While you can install a GTK-based GVim on a Mac under X11, I don't believe you should take that route. This would give you a proper gvim command but you would probably loose on other fronts.



来源:https://stackoverflow.com/questions/15986970/how-to-properly-install-pyclewn-for-vim

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!