vim插件¶
1 Vundle¶
- Vundle:Vim 的插件管理器
- github地址
1.1 安装¶
- 下载Vundle:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
- 编辑.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()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
1.2 使用¶
- 管理插件:在.vimrc文件里面的
call vundle#begin()
和call vundle#end()
之间配置插件,配置规则如下- github仓库插件:
Plugin 'tpope/vim-fugitive'
- 非github上的git仓库:
Plugin 'git://git.wincent.com/command-t.git'
- git仓库在本地的:
Plugin 'file:///home/gmarik/path/to/plugin'
- github仓库插件:
- 安装插件:会去执行
call vundle#begin()
和call vundle#end()
之间配置的插件- 方法一:启动 vim 并运行 :PluginInstall
- 方法二:从命令行安装:vim +PluginInstall +qall
2 主题插件¶
2.1 vim-airline¶
2.1.1 安装¶
使用Vundle安装 - vim编辑将.vimrc文件,在插件块部分插入如下内容
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
- 执行如下安装
:w
:source %
:PluginInstall
- 安装字体文件(有些字体显示不出来,通过此方法解决),下载powerline-font
## clone
git clone https://github.com/powerline/fonts.git --depth=1
## install
cd fonts
./install.sh
- 编辑.vimrc文件,添加如下内容使字体生效
let g:airline_powerline_fonts = 1
2.1.2 配置¶
- vim-airline-themes下有许多自定义主题,显示效果可以从https://github.com/vim-airline/vim-airline/wiki/Screenshots查看
- 使用方式
- 方式一:临时vim下直接使用
:AirlineTheme <theme>
,比如:AirlineTheme violet
- 方式二:永久使用编辑.vimrc文件
let g:airline_theme='<theme>'
,比如let g:airline_theme='violet'
- 方式一:临时vim下直接使用
3 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 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" 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
"
"""""""""
"airline"
"""""""""
let g:airline_theme="violet"
"这个是安装字体后 必须设置此项"
let g:airline_powerline_fonts = 1
"打开tabline功能,方便查看Buffer和切换,省去了minibufexpl插件
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
"""""""""
"airline"
"""""""""