Vundle(https://github.com/VundleVim/Vundle.vim)的全称是Vim Bundle,它是一款Vim插件管理工具。Vundle让你可以非常轻松地安装、更新、搜索和清理Vim插件。它还能管理你的运行时环境,并帮助标记。我在本教程中将介绍如何安装和使用Vundle。
2. 安装Vundle
首先,在~/.vim目录下创建一个bundle目录
然后,下载Vundle.vim到~/.vim/bundle目录下
命令:
$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
3. 配置Vundle
对~/.vimrc文件进行如下配置
- " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
- " the call to :runtime you can find below. If you wish to change any of those
- " settings,you should do it in this file (/etc/vim/vimrc),since debian.vim
- " will be overwritten everytime an upgrade of the vim packages is performed.
- " It is recommended to make changes after sourcing debian.vim since it alters
- " the value of the 'compatible' option.
- " This line should not be removed as it ensures that varIoUs options are
- " properly set to work with the Vim-related packages available in Debian.
- runtime! debian.vim
- " Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
- " This happens after /etc/vim/vimrc(.local) are loaded,so it will override
- " any settings in these files.
- " If you don't want that to happen,uncomment the below line to prevent
- " defaults.vim from being loaded.
- " let g:skip_defaults_vim = 1
- " Uncomment the next line to make Vim more Vi-compatible
- " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
- " options,so any other options should be set AFTER setting 'compatible'.
- "set compatible
- " Vim5 and later versions support Syntax highlighting. Uncommenting the next
- " line enables Syntax highlighting by default.
- if has("Syntax")
- Syntax on
- endif
- " If using a dark background within the editing area and Syntax highlighting
- " turn on this option as well
- "set background=dark
- " Uncomment the following to have Vim jump to the last position when
- " reopening a file
- "if has("autocmd")
- " au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
- "endif
- " Uncomment the following to have Vim load indentation rules and plugins
- " according to the detected filetype.
- "if has("autocmd")
- " filetype plugin indent on
- "endif
- " The following are commented out as they cause vim to behave a lot
- " differently from regular Vi. They are highly recommended though.
- set showcmd " Show (partial) command in status line.
- set showmatch " Show matching brackets.
- set ignorecase " Do case insensitive matching
- set smartcase " Do smart case matching
- "set incsearch " Incremental search
- "set autowrite " Automatically save before commands like :next and :make
- "set hidden " Hide buffers when they are abandoned
- set mouse=a " Enable mouse usage (all modes)
- " Source a global configuration file if available
- if filereadable("/etc/vim/vimrc.local")
- source /etc/vim/vimrc.local
- endif
- set nocompatible
- "filetype off
- " set runtime path
- set rtp+=~/.vim/bundle/Vundle.vim
- " vundle initialize
- call vundle#begin()
- Plugin 'gmarik/Vundle.vim'
- "Plugin 'powerline/powerline'
- Plugin 'Lokaltog/vim-powerline'
- Plugin 'altercation/vim-colors-solarized'
- Plugin 'tomasr/molokai'
- Plugin 'ctrlpvim/ctrlp.vim'
- Plugin 'tacahiroy/ctrlp-funky'
- Plugin 'terryma/vim-multiple-cursors'
- Plugin 'scrooloose/nerdcommenter'
- Plugin 'scrooloose/nerdtree'
- Plugin 'majutsushi/tagbar'
- call vundle#end()
- " 显示当前的行号列号
- set ruler
- " 设置文内智能搜索提示
- " 高亮search命中的文本
- set hlsearch
- " 打开增量搜索模式,随着键入即时搜索
- set incsearch
- " 搜索时忽略大小写
- set ignorecase
- " 有一个或以上大写字母时仍大小写敏感
- set smartcase
- set cursorline
- set number
- " 自动缩进
- set autoindent
- set cindent
- " tab兼的宽度
- set tabstop=4
- set softtabstop=4
- set shiftwidth=4
- " set vim-linestatus
- set laststatus=2
- let g:Powerline_symbols='unicode'
- " set colorscheme
- set background=dark
- "set background=light
- let g:solarized_termcolors=256
- colorscheme solarized