Vim 插件管理器
文章目录需求基础准备系统版本首先安装Vim 插件管理器vim-plug 下载编写插件管理Kubernetesk8s代码块补全缩写大全TIPS相关地址需求安装 Vim 补全插件安装 Kubernetes YAML补全插件基础准备系统版本[root@m1 ~]# cat /etc/redhat-releaseCentOS Linux release 7.7.1908 (Core)首先安装# 安装[ro
·
需求
- 安装 Vim 补全插件
- 安装 Kubernetes YAML补全插件
基础准备
系统版本
[root@m1 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
首先安装
# 安装
[root@m1 ~]# yum -y install git
[root@m1 ~]# yum -y install vim
# 创建目录
mkdir -p ~/.vim/doc
mkdir -p ~/.vim/plugin
mkdir -p ~/.vim/plugged
mkdir -p ~/.vim/syntax
mkdir -p ~/.vim/autoload
Vim 插件管理器
vim-plug 下载
# Github
https://github.com/junegunn/vim-plug
# 存放vim-plug路径
cd ~/.vim/autoload/
# 拉取 plug.vim 插件
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
编写插件管理
# 路径
[root@m1 ~]# vim ~/.vimrc
# 实际插件-------start#
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
" Plug '~/my-prototype-plugin'
Plug 'andrewstuart/vim-kubernetes'
"Plug 'Valloric/YouCompleteMe'
" Initialize plugin system
call plug#end()
set backspace=indent,eol,start
# 实际插件-------end#
# 查看和安装插件
vim
:PlugStatus
:PlugInstall
# 其余的操作
:PlugClean
:PlugUpdate
Kubernetes
k8s代码块补全
# 拉取 vim-kubernetes
[root@m1 ~]# git clone https://github.com/andrewstuart/vim-kubernetes.git
# 复制到 ~/.vim/ 下
[root@m1 ~]# cp -R vim-kubernetes/UltiSnips/ ~/.vim/
# 查看是否存在 yaml.snippets
[root@m1 ~]# ls -la ~/.vim/UltiSnips/
total 12
drwxr-xr-x 2 root root 27 Apr 22 14:00 .
drwxr-xr-x 8 root root 93 Apr 22 13:56 ..
-rw-r--r-- 1 root root 11256 Apr 22 14:00 yaml.snippets
缩写大全
snippet | 全拼 | 描述 |
---|---|---|
rc | Replication Controller | - |
dep | Deployment | - |
svc | Service | - |
depsvc | Deployment and service | - |
depsvcing | Deployment, service, and ingress | - |
pv | PersistentVolume | - |
pvc | PersistentVolumeClaim | - |
ing | Ingress | - |
ns | Namespace | - |
sa | ServiceAccount | - |
ingtls | Ingress TLS section | - |
cfg | ConfigMap | - |
sec | Secret | - |
env | Environment template | - |
secref | env SecretRef | - |
pvol | Pod Volume Object | - |
job | Kubernetes Job | - |
cron | Kubernetes Cronjob | - |
skr | SecretKeyRef | - |
cert | cert-manager certificate | - |
netp | NetworkPolicy | - |
probe | Liveness/Readiness Probes | - |
ss | StatefulSet | - |
res | Resources | - |
init | Init Container | - |
strat | Deployment Strategy | - |
atls | tls-acme annotations | - |
vtls | tls-vault annotations | - |
cmtls | cert-manager tls annotations | - |
edns | external dns | - |
role | Role | - |
rb | RoleBinding | - |
rbac | Role and Binding | - |
hpa | HorizontalPodAutoscaler | - |
pvolm | Volume Mount and spec | - |
volm | Volume Mount | - |
prom | Prometheus annotations | - |
aff | Affinitiy/Anti-Affinity | - |
hpa | Horizontal Pod Autoscaler | - |
TIPS
1、使用 vim --version | grep python 查看 vim是否开启支持ptyhon
[root@m1 bin]# vim a.yaml
YouCompleteMe unavailable: unable to load Python.
Press ENTER or type command to continue
相关地址
- Github
- https://github.com/junegunn/vim-plug
- https://github.com/andrewstuart/vim-kubernetes
- Kubernetes的vim补全插件
- https://www.jianshu.com/p/0cb5c9227f66
- vim插件YouCompleteMe安装(vim-plug不推荐)
- https://zhuanlan.zhihu.com/p/54074345
更多推荐
已为社区贡献1条内容
所有评论(0)