Vim插件管理工具Vundle


1 插件目录 ~/.vim/bundle/ 没有则自行创建

2 安装Vundle

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

3 配置插件 vi ~/.vimrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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

常用插件

1 NERD Tree

配置:

1
2
map <F3> :NERDTreeToggle<CR> "开关快捷键 
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif "自动关闭

2 Pydiction

配置:

1
2
3
filetype plugin on
let g:pydiction_location = '~/.vim/bundle/pydiction/complete-dict'
let g:pydiction_menu_height = 4 "显示匹配结果的行数,默认为8

3 molokai

一款不错的主题
把molokai.vim拷贝到~/.vim/colors/ 或者/usr/share/vim/vim74/colors/目录中
配置:

1
2
3
4
syntax enable
set to_Co=256
set background=dark
colorscheme molokai

4 vim-markdown vim-markdwon-preview.vim

vim-markdown 语法高亮
vim-markdown-preview.vim 通过浏览器实时预览(支持同步滚动)
安装

1
2
Plugin 'plasticboy/vim-markdown'
Plugin 'iamcco/markdown-preview.vim'

:PluginInstall

使用

1
2
3
:MarkdownPreview      " 在打开 markdown 文件后,使用该命令可以打开预览窗口

:MarkdownPreviewStop " 关闭 markdown 预览窗口,并停止开启的服务进程

可选配置

1
let g:mkdp_auto_start= 1   "打开.md文件时 自动打开预览窗口

效果图


1.如果本文帮到了您,不妨点一下右下角的 分享按钮.
2.您的鼓励是博主写作最大的动力,感谢您的分享和赞赏.