在安装之前需要安装npm
yarn
node.js
# 这里以ubuntu示例
sudo apt install clang # 如果是c,c++补全需要安装
# 安装npm
sudo apt-get install npm
# 安装yarn
sudo npm install -g yarn
# 安装升级node.js到最新版本
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
node -v
Vundle
添加下面的内容到.vimrc
:
Plugin 'neoclide/coc.nvim'
VimPlug
添加下面的内容到.vimrc
:
Plug 'neoclide/coc.nvim'
在Vim
里面运行以下命令:
:source %
:PlugInstall
等待成功安装
在Vim
里面运行以下命令:
:CocInstall coc-clangd
等待成功安装即可
可能遇到的问题
提示vim版本过低
# 更新版本vim版本
sudo add-apt-repository ppa:jonathonf/vim
sudo apt update
sudo apt upgrade
或者是
[coc.nvim] build/index.js not found, please install dependencies and compile coc.nvim by: yarn install
# 解决办法
# ~/.vim/bundle/coc.nvim/ #是我的coc.nvim插件的安装目录
cd ~/.vim/bundle/coc.nvim/
yarn install
yarn build
参考文章