Skip to content

Full Installation Guide

starifly edited this page Feb 20, 2023 · 7 revisions

如果VIM版本低于8.1需要重新安装VIM:

1.卸载VIM

sudo apt remove vim vim-runtime gvim
sudo apt remove vim-tiny vim-common vim-gui-common vim-nox

2.安装依赖

sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git

3.安装VIM

如果你用的不是vim 8.1,请确保下面的 VIMRUNTIMEDIR 变量正确,如果编译过,请先 make distclean

cd ~
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-python3interp=yes --with-python3-config-dir=/usr/local/lib/python3.6/config-3.6m-x86_64-linux-gnu --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2 --enable-cscope --prefix=/usr/local
make VIMRUNTIMEDIR=/usr/local/share/vim/vim81
sudo checkinstall

安装FlyVim(请确保curl已经安装)

https://github.com/starifly/FlyVim#install

安装YCM(请确保cmake、clang已经安装,如果缺少其它系统组件请自行安装):

1.获取YCM

cd ~/.vim/bundle
git clone --recursive https://github.com/Valloric/YouCompleteMe.git
cd ~/.vim/bundle/YouCompleteMe
git submodule update --init --recursive

2.下载clang(7.0以上版本)

http://llvm.org/releases/download.html 下载对应系统的clang(已经编译好的Pre-Built Binaries) 解压到 ~/ycm_temp/llvm_root_dir 文件夹

cd ~
mkdir -p ycm_temp/llvm_root_dir
cd ycm_temp/llvm_root_dir
sudo cp -r * /usr/local

3.安装YCM

cd ~
mkdir ycm_build
cd ycm_build/
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir -DUSE_PYTHON2=OFF .  ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
or cmake -G "Unix Makefiles" -DEXTERNAL_LIBCLANG_PATH=/usr/local/lib/libclang.so -DUSE_PYTHON2=OFF .  ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/
or cmake -G "Unix Makefiles" -DUSE_SYSTEM_LIBCLANG=ON -DUSE_PYTHON2=OFF .  ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/
cmake --build . --target ycm_core --config Release

4.安装regex模块(可选)

cd ~
mkdir regex_build
cd regex_build
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/cregex
cmake --build . --target _regex --config Release