地址https://github.com/VundleVim/Vundle.vim
- 下载源码:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
- 如果~/.vim/bundle目录不存在,则新建目录:
cd ~
mkdir -p .vim/bundle
将下列配置放在.vimrc文件的开头:
注意:" 表示vim配置的注释
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
如果想下载某个插件,比如自动缩进indentpython.vim插件,需要将Plugin 'vim-scripts/indentpython.vim'置于call vundle#begin()和call vundle#end()之间,保存配置后在vim中执行
:PluginInstall
即可以自动下载indentpython.vim插件了。
- bundle可以管理下载几种不同的插件,方式如下:
- github上的插件
Plugin 'tpope/vim-fugitive' - 来自于http://vim-scripts.org/vim/scripts.html的插件
Plugin 'L9' - 非github上的git插件
Plugin 'git://git.wincent.com/command-t.git' - 本地插件
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/'}
有旧插件的情况下,下载新的插件并重命名以避免冲突
Plugin 'ascenator/L9', {'name': 'newL9'}
下载方式除了在vim中运行:PluginInstall外,还可以在命令行中运行:
vim +PluginInstall +qall
其它常用的命令:
: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
- 安装插件
- 缩进指示线
安装:
Plugin 'Yggdroot/indentLine'
开关:
:IndentLinesToggle
默认Tab键是功能切换键
可以定义一个快捷键
map :IndentLinesToggle
注意:
上边的
- 自动格式化工具
地址https://github.com/Yggdroot/indentLine
首先安装autopep8:
$ pip install autopep8
Plugin 'tell-k/vim-autopep8'
可以设置快捷键F8代替:Autopep8:
autocmd FileType python noremap :call Autopep8()
注意:
:q退出当前窗口
Ctrl + w(两下)可以在窗口间跳动
- 自动缩进插件
Plugin 'vim-scripts/indentpython.vim'
- 语法检查
Plugin 'vim-syntastic/syntastic'
- 配色方案
Plugin 'altercation/vim-colors-solarized'
syntax enable
set background=light 或者 dark
colorscheme solarized
- 树形目录
Plugin 'scrooloose/nerdtree'
开关树形目录的快捷键:
map :NERDTreeToggle
注意:
上边的
- 自动补全括号和引号等
Plugin 'jiangmiao/auto-pairs'