简体   繁体   中英

Installing clang_complete for vim on Ubuntu

I'm having trouble installing the clang_complete plugin for vim on Ubuntu. I built vim from source to enable python support, and I used vim --version to confirm that it has the following features enabled:

+python/dyn
+python3/dyn

I have my ~/.vim/vimrc setup as follows (nothing omitted):

syntax on
let g:clang_library_path='/usr/local/lib'

Here is the exact error output on vim startup when I try to edit a .cpp file:

Error detected while processing function
<SNR>6_ClangCompleteInit..<SNR>6_initClangCompletePython:

line    2:
clang_complete: No python support available.

line    3: Cannot use
clang library

line    4: Compile vim with python support to use
libclang

Can anyone with clang_complete experience help me out? Thanks!

OK, found a solution!

Pull down a fresh vim, or run sudo make uninstall and sudo make distclean in the vim and vim/src directory. Once you're ready at the root directory of the source:

cd src
sudo ./configure --enable-pythoninterp=yes --enable-python3interp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu --with-python3-config-dir=/usr/lib/python3.4/config-x86_64-linux-gnu
sudo make install

You may need to adjust the version numbers and path to your config-dir, but this finally worked for me in Ubuntu 14.04. For some strange reason vim --version still shows +python/dyn and +python3/dyn . If you look at the vim docs this appears to be a Windows only feature, but the true test is running :echo has('python') at the vim command line. You should get a 1 for true. Otherwise your build is still lacking python.

Make sure your ~/.vimrc or ~/.vim/vimrc is set up like I have above. Then use vim to open a .cpp file. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM