clang_complete in Vim

你。 提交于 2019-12-18 11:52:25

问题


So after playing around with omnicpp, gccsense and clang_complete I couldn't get any of them to work. So I apt-get purge vim-* and tried again to install clang_complete, but without success.

Here's what I do:

  1. Download clang_complete.vmb, move it to my fresh, clean .vim dir and execute vim clang_complete.vmb -c 'so %' -c 'q'.

  2. Paste this into my .vimrc:

    syntax on
    set number
    filetype plugin on
    let g:clang_user_options='|| exit 0'
    let g:clang_complete_auto = 1
    let g:clang_complete_copen = 1
    
  3. Create a typical example

    #include <iostream>
    #include <string>
    
    int main() { std:: (I get: User defined pattern not found) }
    

Is there anything else I need to do/install to get it working? And silly question I've heard about Clang, do I need to apt-get install it?


回答1:


clang_complete can be configured to use the clang executable or the clang library

clang_complete uses the clang executable by default but the clang library will execute lot faster

clang_complete plugin (using the clang executable) needs:

  1. clang must be installed in your system and be in the PATH
  2. do not set (let) g:clang_library_path to a path containing the libclang.so library

clang_complete plugin (using the clang library) needs:

  1. python installed in your system
  2. vim must be built with python support (do :version and look for a +python/dyn or +python3/dyn entry)
  3. set (let) g:clang_library_path to the directory path where libclang.so is contained



回答2:


let g:clang_library_path='/usr/lib/llvm3.5/lib/libclang.so.1' in my .vimrc and it works fine.



来源:https://stackoverflow.com/questions/10259485/clang-complete-in-vim

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