Dolphin的博客

Vim插件

Vim-airline

一款状态栏增强插件,可以让你的Vim状态栏非常的美观。

安装vim-airline插件首先在.vimrc文件中添加插件名称Plugin ‘bling/vim-airline',添加完毕后执行Vundle插件安装命令:PluginInstall命令安装插件。插件安装完毕后还未立即生效,在Vim配置文件.vimrc中添加如下配置即可生效:

1
2
" vim-airline
set laststatus=2 " 永远显示状态栏

效果如下图所示:

Vundle

Vundle是一款Vim编辑器插件,用于管理Vim编辑器的插件。安装Vundle输入如下命令:

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

配置Vundle:

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" 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
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

Ctrlp

ctrlp是一款相当棒的插件,主要的功能是对文件进行模糊的查找,如果你的project目录结构复杂,或者你正在阅读一个较大的项目的话,那么ctrlp可以帮你快速的定位到你想要文件。安装Ctrlp,在.vimrc文件中加入:

1
2
# 使用的Vundle版本是0.10.2,较早版本的写法是Bundle 'ctrlpvim/ctrlp.vim'
Plugin 'ctrlpvim/ctrlp.vim'

在Vim中执行命令:PluginInstall即可安装。安装完毕后,使用Vim打开文件夹,可以直接输入Ctrl + P快捷键调出Ctrlp的模糊搜索功能。输入需要搜索的关键字,匹配的文件出来后,可以按下Ctrl + j/k快捷键进行上下选择。选定需要打开的文件后,使用快捷键Ctrl +x/v水平/垂直分屏打开文件。按下Ctrl + t在新的Tab中打开文件。

NERD Tree

树形的文件浏览。安装NERD Tree,在配置文件中添加如下配置:

1
2
3
4
Plugin 'scrooloose/nerdtree'
let NERDTreeWinPos='right'
let NERDTreeWinSize=30
map <F2> :NERDTreeToggle<CR>

Vim Powerline

Markdown

1
2
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'

代码补全(YouCompleteMe,语法检查(syntastic),文件模糊搜索(ctrlp),显示vim状态栏(Vim Powerline),主题颜色(Molokai),显示文件结构(tagbar)