在设置配置文件前, 请确保以下命令的输出为 1
.
:echo has("python_dynamic")
以及
:echo has("python3_dynamic")
在 _vimrc
(或 .vimrc
) 中添加如下语句
" Python3
set pythonthreehome=D:\Python3.7.3
set pythonthreedll=D:\Python3.7.3\python37.dll
如果你使用的是 Python2 , 添加如下语句.
" Python2
set pythonhome=D:\Python2
set pythondll=D:\Python2\python27.dll
配置完成后, 重新加载 vimrc
, 使用以下命令来检查输出是否正确
:py3 print("test")
Python2
:py print "test"
从 项目主页 上下载 plug.vim
文件, 然后将其添加在 vim82\autoload
文件下.
若在 vim-plug 下载过程出现超时以及 SSL 错误, 可在给设置 git bash 代理后, 手动 git clone
项目到插件文件夹中. 注意, git bash 的代理设置是全局的, 也就是设置代理并关闭窗口后, 下一次打开窗口仍然会保留上次的代理设置.
设置代理
git config --global http.proxy http://127.0.0.1:1081
git config --global https.proxy http://127.0.0.1:1081
查看代理
git config http.proxy
git config https.proxy
取消代理
git config --unset http.proxy
git config --unset https.proxy
若在 cmake 的编译过程中, 下载依赖时出现下载超时以及 SSL 错误, 可在 CMD 窗口中设置代理后重新进行编译. CMD 的代理设置是针对于窗口的, 多个窗口间不会相互影响.
设置代理
set http_proxy=http://127.0.0.1:1081
set https_proxy=http://127.0.0.1:1081
查看代理
set http_proxy
set https_proxy
在 _vimrc
(或 .vimrc
) 文件中添加如下内容
call plug#begin('./plugs')
Plug 'ycm-core/YouCompleteMe'
call plug#end()
其中 ./plugs
为插件的目录, ycm-core/YouCompleteMe
为项目的地址.
添加完毕后, 重启 vim 或重新载入配置文件, 输入以下命令以下载 YouCompleteMe
:PlugInstall
打开 CMD , 移动到 ./vim82/plugs/YouCompleteMe
目录, 输入以下命令来编译 YouCompleteMe
python3 install.py
上述命令仅编译了 YouCompleteMe , 并没有添加相应的语言支持. 若要添加相应的语言支持, 确保正确配置了相应语言环境的同时, 在编译命令中加入以下参数
--clangd-completer
--cs-completer
when calling ./install.py
.--go-completer
when calling ./install.py
.--ts-completer
when calling install.py
.--rust-completer
when calling ./install.py
.--java-completer
when calling ./install.py
.举个例子, 添加 C 语言系列支持:
python3 install.py --clangd-completer
如果要添加所有的语言支持, 可输入以下命令
python3 install.py --all
打开 vim , 输入命令
:scriptnames
若 youcompleteme.vim
包含在加载列表中, 则表明安装成功.