$cat my_vimrc.sh#!/bin/bashcd ~git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vimcp ~/.vimrc ~/.vimrc.bakvim +BundleInstall +nerdtree
$cat ~/.vimrcset nocompatible " be iMproved, requiredfiletype off " required"---------------------------------------------------------------" set the runtime path to include Vundle and initializeset 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" 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' Plugin 'git://github.com/scrooloose/nerdtree.git' Plugin 'git://github.com/Xuyuanp/nerdtree-git-plugin.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 linecall vundle#end() " required"---------------------------------------------------------------" NERDTree config" map :NERDTreeToggle " autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType")" &&b:NERDTreeType == "primary") | q | endif"第一条是说使用F2键快速调出和隐藏它;"第二条是关闭vim时,如果打开的文件除了NERDTree没有其他文件时,它自动关闭,减少多次按:q!。"如果想打开vim时自动打开NERDTree,可以如下设定autocmd vimenter * NERDTree" 关闭NERDTree快捷键map t :NERDTreeToggle " 显示行号let NERDTreeShowLineNumbers=1let NERDTreeAutoCenter=1" 是否显示隐藏文件let NERDTreeShowHidden=1" 设置宽度let NERDTreeWinSize=31" 在终端启动vim时,共享NERDTreelet g:nerdtree_tabs_open_on_console_startup=1" 忽略一下文件的显示let NERDTreeIgnore=['\.pyc','\~$','\.swp']" 显示书签列表let NERDTreeShowBookmarks=1" 使用F2键快速调出和隐藏它map :NERDTreeToggle " 关闭vim时,如果打开的文件除了NERDTree没有其他文件时,它自动关闭,减少多次按:q!autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif"---------------------------------------------------------------"开发的过程中,我们希望git信息直接在NERDTree中显示出来, 和Eclipse一样,修改的文件和增加的文件都给出相应的标注, 这时需要安装的插件就是 nerdtree-git-pluginlet g:NERDTreeIndicatorMapCustom = { \ "Modified" : "✹", \ "Staged" : "✚", \ "Untracked" : "✭", \ "Renamed" : "➜", \ "Unmerged" : "═", \ "Deleted" : "✖", \ "Dirty" : "✗", \ "Clean" : "✔︎", \ "Unknown" : "?" \ }"---------------------------------------------------------------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
另外一个配置
#cat ~/.vimrcset nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.html" Plugin 'L9'" Git plugin not hosted on GitHubPlugin '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 linecall vundle#end() " requiredfiletype 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 lineset nocompatiblesource $VIMRUNTIME/vimrc_example.vim"source $VIMRUNTIME/mswin.vim"behave mswinset ruler"set nusyntax onsyntax enableset ts=4set noerrorbellsset sw=4"set autoindent"set smartindentfiletype onset foldlevel=100"set ignorecase smartcaseset so=5colo desertautocmd FileType c,py setl fdm=syntax | setl fen"let g:sh_fold_enabled= 1set nobackup"set cursorline"set cursorcolumn:runtime macros/matchit.vimau BufNewFile,BufRead *.t2t set ft=txt2tags"set foldcolumn=4set mouse-=anmap # I# jmap :tabnew set encoding=utf-8set termencoding=utf-8set fileencodings=ucs-bom,utf-8,gb18030,gbk,gb2312,big5,euc-jp,euc-kr,latin1,cp936autocmd BufNewFile *.sh,*.pl,*.py exec ":call SetTitle()""autocmd BufWrite *.sh,*.pl,*.py exec ":call ModifyTitle()"autocmd BufWrite *.sh,*pl,*py if getline(6) != "# Modify Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") || split(getline(7))[3] != strftime("%F") | call ModifyTitle() | endifautocmd BufNewFile,BufRead *.py exec ":call SetTable()"func SetTable() set expandtab set tabstop=4 set shiftwidth=4endfuncfunc SetTitle() if &filetype == 'sh' call setline(1, "\#!/bin/sh") call append(line("."), "\#****************************************************************#") call append(line(".")+1, "\# ScriptName: ".expand("%") ) call append(line(".")+2, "\# Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call append(line(".")+3, "\# Create Date: ".strftime("%F %R")) call append(line(".")+4, "\# Modify Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call append(line(".")+5, "\# Modify Date: ".strftime("%F %R")) call append(line(".")+6, "\# Function: " ) call append(line(".")+7, "\#***************************************************************#") call append(line(".")+8, "") :8 elseif &filetype == 'perl' call setline(1, "\#!/usr/bin/perl") call append(line("."), "\#****************************************************************#") call append(line(".")+1, "\# ScriptName: ".expand("%") ) call append(line(".")+2, "\# Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call append(line(".")+3, "\# Create Date: ".strftime("%F %R")) call append(line(".")+4, "\# Modify Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call append(line(".")+5, "\# Modify Date: ".strftime("%F %R")) call append(line(".")+6, "\# Function: ") call append(line(".")+7, "\#***************************************************************#") call append(line(".")+8, "") :8 elseif &filetype == 'python' call setline(1, "\#!/usr/bin/python") call append(line("."), "\#****************************************************************#") call append(line(".")+1, "\# ScriptName: ".expand("%") ) call append(line(".")+2, "\# Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call append(line(".")+3, "\# Create Date: ".strftime("%F %R")) call append(line(".")+4, "\# Modify Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call append(line(".")+5, "\# Modify Date: ".strftime("%F %R")) call append(line(".")+6, "\# Function: ") call append(line(".")+7, "\#***************************************************************#") call append(line(".")+8, "") :8 endifendfuncfunc ModifyTitle() if getline(6) =~ "# Modify Author:.*" call setline(6, "\# Modify Author: ".expand("$SHTERM_REAL_USER@alibaba-inc.com") ) call setline(7, "\# Modify Date: ".strftime("%F %R")) endifendfunc