19

所以在玩弄了omnicpp、gccsense和clang_complete之后,我无法让它们中的任何一个工作。所以我apt-get purge vim-*再次尝试安装clang_complete,但没有成功。

这就是我所做的:

  1. 下载clang_complete.vmb,将其移动到我新鲜、干净的.vim目录并执行vim clang_complete.vmb -c 'so %' -c 'q'

  2. 将此粘贴到我的 .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. 创建典型示例

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

我还需要做什么/安装才能让它工作吗?我听说过关于 Clang 的愚蠢问题,我需要apt-get install吗?

4

2 回答 2

25

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
于 2012-06-05T16:11:05.210 回答
4

let g:clang_library_path='/usr/lib/llvm3.5/lib/libclang.so.1' 在我的 .vimrc 中,它工作正常。

于 2015-06-05T01:30:45.810 回答