安装plug (https://github.com/junegunn/v... curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent...
编辑~/.vimrc文件(不存在,则创建)
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" Initialize plugin system
call plug#end()
打开vim,输入:PlugInstall
加载插件
vim 需要开启对 python 的支持,通过以下两个方式来验证你的 vim 是否支持 python 接口,支持一种即可
:echo has("python") " 如果你用的是 python 2.7
:echo has("python3") " 如果你用的是 python 3.3 或者 3.4
当我们打开 vim 的时候, UltiSnips 会搜寻 $VIM 路径下的所有名字为 UltiSnips 的文件夹,然后根据文档类型来寻找对应的 snips。配置$VIM
export VIM=~/.vim
验证vim a.cpp
,输入main。按tab键,自动补全则成功
int main(int argc, char *argv[])
{
return 0;
}
添加k8s相关snippet (https://github.com/andrewstua...,将里面UltiSnips目录下的yaml.snippets文件移动到.vim目录下的UltiSnips文件下,就可以使用了,如vim a.yaml
apiVersion: v1
kind: Service
metadata:
name: frontend
namespace: default
labels:
app: someApp
tier: frontend
spec:
ports:
- port: 80
selector:
app: someApp
tier: frontend