环境:Liunx, vim, git
插件管理器vim-plug
Github地址:https://github.com/junegunn/vim-plug
直接复制文档中 Installation -> Unix 的内容,回车
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
安装好后编辑.vimrc文件
sudo vim ~/.vimrc
输入两行:
call plug#begin()
call plug#end()
之后要应用的插件直接写到这两行中间即可。
安装NERDTree
常用vim插件可在此找到:https://vimawesome.com
搜索NERDTree,进入其主页:
点击VimPlug,将配置复制.vimrc两行call中间:
call plug#begin()
Plug 'scrooloose/nerdtree'
call plug#end()
进入vim,在命令模式下输入PlugInstall:回车等待插件安装完毕。
自动启用NERDTree:在.vimrc最后加入一句:
autocmd VimEnter * NERDTree
常用操作:
命令模式输入:NERDTree打开目录结构,光标移动选择文件,回车即可编辑。
左右栏切换:ctrl + w
安装vim-colorschemes
同样在两行call中写入:
Plugin 'flazz/vim-colorschemes'
vim在命令模式下输入PlugInstall,等待插件安装完成。
colorschemes的github主页为:https://github.com/flazz/vim-colorschemes
在文档中找到Using,选择一种主题颜色,写到.vimrc最后。例如:
colorscheme molokai
重新打开vim即可看到颜色改变。
其他插件同样方法安装即可。
插件卸载
1 删除.vimrc两行call之间的配置语句。
2 在vim命令模式输入:PlugClean,选择y即可彻底删除插件。