1 插件目录 ~/.vim/bundle/ 没有可自行创建
2 安装Vundle
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
3 配置插件
vi ~/.vimrc
添加:
set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin(‘~/some/path/here‘) " let Vundle manage Vundle, required Plugin ‘VundleVim/Vundle.vim‘ " plugin on GitHub repo Plugin ‘rkulla/pydiction‘ "Python Tab自动补全Plugin ‘scrooloose/nerdtree‘ "可以显示资源列表Plugin ‘tomasr/molokai‘ "molokai主题 " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " :PluginSearch foo - searches for foo; append `!` to refresh local cache " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
4 安装插件
保存上面配置文件,进入vim(或vi打开任意文件),执行:
:PluginInstall ,会自动从github获取安装配置文件中添加的插件。
:PluginList 可以查看已经安装的插件
5 卸载插件
将.vimrc中安装插件行注释或删除,执行 :PluginClean
常用插件
功能:
安装:在.vimrc中添加 Plugin ‘scrooloose/nerdtree‘ , 执行 :PluginInstall
配置:为了方便,可以在.vimrc中配置开关快捷键
map <F3> :NERDTreeToggle<CR>
配置当只剩NERDTree时,自动关闭vim:
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
用法:
F3(上面配置的) -- 打开/关闭 NERDTree
s -- 水平分割式打开文件(光标所在行的文件)
i -- 竖直方向...
功能:python的Tab键自动补全
安装:同上
配置:在.vimrc中添加以下
filetype plugin on let g:pydiction_location = ‘/home/user/.vim/bundle/pydiction/complete-dict‘ let g:pydiction_menu_height = 4 "显示匹配结果的行数,默认为8
用法:
<Space> -- 接受当前匹配,并添加一个空格 CTRL-Y -- 接受当前匹配,但不添加空格 <Enter> -- 接受当前匹配,并转到下一行 CTRL-E -- 取消当前匹配
3 molokai
一个比较舒服的主题把molokai.vim拷贝到~/.vim/colors/ 或者/usr/share/vim/vim74/colors/目录中在.vimrc中配置
syntax enable set to_Co=256 set background=dark colorscheme molokai
时间: 2024-10-21 09:33:18