安装vimplug,在github上可以搜索下载
怎么使用呢?
你需要打开vim的配置文件(vimrc),然后添加些内容。
1、 call plug#begin([PLUGIN_DIR]) 方括号内的写相关文件夹。本句表示开始
2、在下面列出你想要安装的插件
3、call plug#end() 表示结束
进入# VimAwesome,按照它的提示安装插件
插件:
Plug 'valloric/youcompleteme'
… then run the following in Vim:
:source %
:PlugInstall
ps:这些需要添加到 ~/.vimrc中,如果你没有~/.vimrc并把它添加到了/etc/vimrc,那么就
cp /etc/vimrc ~/.vimrc
还有,需要autoload/的可执行权限,可运行以下代码赋予权限:
sudo chmod +rwx autoload/
安装完插件打开vim出现:The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code 1.
cd ~/.vim/plugged/YouCompleteMe
/usr/bin/python [install.py]
出现 ERROR: Unable to find executable 'cmake'. CMake is required to build ycmd
安装一个cmake
yay -Syu cmake
自动补括号(auto-pairs)
安装
Plug 'jiangmiao/auto-pairs'
配置
au Filetype FILETYPE let b:AutoPairs = {"(": ")"}
au FileType php let b:AutoPairs = AutoPairsDefine({'<?' : '?>', '<?php': '?>'})
跳出括号
func SkipPair()
if getline('.')[col('.') - 1] == ')' || getline('.')[col('.') - 1] == ']' || getline('.')[col('.') - 1] == '"' || getline('.')[col('.') - 1] == "'" || getline('.')[col('.') - 1] == '}'
return "\<ESC>la"
else
return "\t"
endif
endfunc
inoremap <TAB> <c-r>=SkipPair()<CR>