cxxd
cxxd copied to clipboard
How to install this with vim
Hi, I found the discussion hard to follow. I want to use cxxd with its accompanying vim plugin. Can you please outline the steps what needs to be done.
https://github.com/JBakamovic/cxxd-vim/blob/master/README.md#installation
@JBakamovic I did that but it gives the following error:
Error detected while processing /home/cohesity/.vim/plugged/cxxd-vim/plugin/cxxd/server.vim: line 4: E319: Sorry, the command is not available in this version: python import os, sys, vim line 5: E319: Sorry, the command is not available in this version: python sys.path.append(vim.eval("fnamemodify(fnamemodify(expand('<sfile>:p:h'), ':h'), ':h')") + os.sep + 'lib') line 10: E319: Sorry, the command is not available in this version: python import cxxd.api line 15: E319: Sorry, the command is not available in this version: python server_handle = None Error detected while processing /home/cohesity/.vim/plugged/cxxd-vim/plugin/cxxd.vim: line 15: cxxd-vim requires (G)Vim compiled with 'python' feature. Press ENTER or type command to continue
Following is my vim version output(which seems to have python installed):
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 31 2019 10:33:21) Included patches: 1-1779 Modified by [email protected] Compiled by [email protected] Huge version with GTK2 GUI. Features included (+) or not (-): +acl -farsi -mouse_sysmouse -tag_any_white +arabic +file_in_path +mouse_urxvt +tcl +autocmd +find_in_path +mouse_xterm +termguicolors +autochdir +float +multi_byte +terminal -autoservername +folding +multi_lang +terminfo +balloon_eval -footer -mzscheme +termresponse +balloon_eval_term +fork() +netbeans_intg +textobjects +browse +gettext +num64 +textprop ++builtin_terms -hangul_input +packages +timers +byte_offset +iconv +path_extra +title +channel +insert_expand +perl +toolbar +cindent +job +persistent_undo +user_commands +clientserver +jumplist +postscript +vartabs +clipboard +keymap +printer +vertsplit +cmdline_compl +lambda +profile +virtualedit +cmdline_hist +langmap -python +visual +cmdline_info +libcall +python3 +visualextra +comments +linebreak +quickfix +viminfo +conceal +lispindent +reltime +vreplace +cryptv +listcmds +rightleft +wildignore +cscope +localmap +ruby +wildmenu +cursorbind +lua +scrollbind +windows +cursorshape +menu +signs +writebackup +dialog_con_gui +mksession +smartindent +X11 +diff +modify_fname -sound -xfontset +digraphs +mouse +spell +xim +dnd +mouseshape +startuptime +xpm -ebcdic +mouse_dec +statusline +xsmp_interact +emacs_tags +mouse_gpm -sun_workshop +xterm_clipboard +eval -mouse_jsbterm +syntax -xterm_save +ex_extra +mouse_netterm +tag_binary +extra_search +mouse_sgr -tag_old_static system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" 2nd user gvimrc file: "~/.vim/gvimrc" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -std=gnu99 -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/ruby1.9.1-E8yHvR/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu -lpython3.4m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
I am ssh'ing to a remote machine and using vim (just in case it matters)
It has python3 support compiled in but python seems not. You can try removing has("python") check from plugin/cxxd.vim at line 14 but I am not sure if it is gonna work or not. I haven't tested this combination.
@JBakamovic I removed has("python") check from plugin/cxxd.vim. Additionally, I had to change cxxd/server.vim to use import statements like
python3 import os, sys, vim
python3 sys.path.append(vim.eval("fnamemodify(fnamemodify(expand('<sfile>:p:h'), ':h'), ':h')") + os.sep + 'lib')
python3 server_handle = None
However, changing the following: python import cxxd.api to python3 import cxxd.api lead to this exception:
Error detected while processing /home/cohesity/.vim/plugged/cxxd-vim/plugin/cxxd/server.vim: line 10: Traceback (most recent call last): File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked AttributeError: 'module' object has no attribute '__path__' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/cohesity/.vim/plugged/cxxd-vim/lib/cxxd/api.py", line 1, in <module> from server import ServiceId File "/home/cohesity/.vim/plugged/cxxd-vim/lib/server.py", line 1, in <module> import cxxd.server File "/home/cohesity/.vim/plugged/cxxd-vim/lib/cxxd/server.py", line 4, in <module> from parser.cxxd_config_parser import CxxdConfigParser ImportError: No module named 'parser.cxxd_config_parser'; 'parser' is not a package
Keeping this as it is: python import cxxd.ap gives the old error: python import cxxd.api line 15: E319: Sorry, the command is not available in this version:
Any suggestions to fix this? Any plans to support this configuration in future?
Given that Python2 support is EOL by the end of this year, I guess I will have to consider porting whole implementation to Python3. But honestly I've been very time-constrained for the past few months and will be for upcoming ones so I am not sure if I am gonna be able to find a free time-slot. So, any contribution would be welcome of course :)
@JBakamovic not sure how much time I have for myself, but will give it a try. This project seems promising(I am not sure if anyone out there provides such functionality). Any pointers to getting started?
@amandeepgautam There is a utility, 2to3, which is ought to automate Python2 to Python3 transition. See here.
I would approach the process with following steps:
- For each
.pyfile in the project:
- Run
2to3on it (e.g.2to3 -w api.py). - Run unit-test suite to verify that things are not broken (
python3 tests/run_unit_tests.py).
- Once unit-test suite is running with applied changes, verify that integration-test suite is also working (
python3 tests/run_integration_tests.py).
As you can see, it looks pretty much straightforward but I guess that some steps will require some plumbing around. Let me know if you get stuck anywhere, I will be pleased to help.
Hi, I am interested about cxxd. Is this python-related problem still a thing?
Yes, transition to python3 is still WIP. I've got a hacked version of it though and I'm keeping the changes in migration_to_python3 branch. Merging it with master will require some polishing for which I haven't found any spare time yet.
With c541f8a8 python3 transition has been completed.