YouCompleteMe插件安装

Vundle 安装

YouCompleteMe 安装

vim升级

# 需要开启python3
cd /tmp && git clone https://github.com/vim/vim.git && cd vim/src
sudo make distclean
export LDFLAGS="-rdynamic";./configure --enable-python3interp=yes --with-python3-command=python3 --prefix=/home/xxx/opt/vim 
./configure --with-features=huge \
--enable-multibyte \
--enable-python3interp=yes \
--enable-cscope \
--enable-gui=auto \
--enable-gtk2-check \
--enable-fontset \
--enable-largefile \
--disable-netbeans \
--with-compiledby="xxx@email.com" \
--enable-fail-if-missing \
--with-python3-command=python3 \
--prefix=/usr/local 

export LDFLAGS="-rdynamic";make -j4 && sudo make -j4 install

python3升级

'bz2 is module not available' 安装libbz2-dev,重新编译python

--enable-shared 开启动态共享库

Problems installing Python 3 with --enable-shared

sudo apt-get install libbz2-dev
sudo apt-get install liblzma-dev

export LD_RUN_PATH=~/opt/python3.10/lib;./configure --prefix=~/opt/python3.10/ --enable-shared
export LD_RUN_PATH=/home/xxx/python3.10/lib;make -j4 && make install -j4

安装python3模块

pip3 install pygments
pip3 install flake8
pip3 install pylint

YouCompleteMe 编译

cd ~/.vim/bundle/YouCompleteMe/
git submodule update --init --recursive

python3 install.py --all

python3 install.py --clangd-completer

python3 install.py --java-completer

YouCompleteMe 日志

在vim配置文件中加上下面的选项

let g:ycm_server_keep_logfiles = 1
let g:ycm_server_log_level = 'debug'

几个常用命令:

  • :YcmToggleLogs: 即可查看到错误日志 及调试信息使用
  • :YcmDebugInfo: 可以查看ycm相关的信息,包括编译标志,版本等等
  • :YcmDiags: 查看当前文件中的错误信息

比如下面clangd需要GLIBC_2.29, 于是我降级clangd版本,修改third_party/ycmd/build.py中的CLANGD_VERSION 和checksum值

$ /home/tangshunhui/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd -header-insertion-decorators=0 -resource-dir=/home/tangshunhui/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/16.0.0 -limit-results=500
/home/tangshunhui/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/tangshunhui/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd)
/home/tangshunhui/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/tangshunhui/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd)
posted @ 2023-06-04 15:31  梦过无声  阅读(309)  评论(2编辑  收藏  举报