$cat my_vimrc.sh
#!/bin/bash
cd ~
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cp ~/.vimrc ~/.vimrc.bak
vim +BundleInstall +nerdtree
$cat ~/.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
" 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 line
call vundle#end() " required
"---------------------------------------------------------------
" NERDTree config
" map <F2> :NERDTreeToggle<CR>
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType")
" &&b:NERDTreeType == "primary") | q | endif
"第一条是说使用F2键快速调出和隐藏它;
"第二条是关闭vim时,如果打开的文件除了NERDTree没有其他文件时,它自动关闭,减少多次按:q!。
"如果想打开vim时自动打开NERDTree,可以如下设定
autocmd vimenter * NERDTree
" 关闭NERDTree快捷键
map <leader>t :NERDTreeToggle<CR>
" 显示行号
let NERDTreeShowLineNumbers=1
let NERDTreeAutoCenter=1
" 是否显示隐藏文件
let NERDTreeShowHidden=1
" 设置宽度
let NERDTreeWinSize=31
" 在终端启动vim时,共享NERDTree
let g:nerdtree_tabs_open_on_console_startup=1
" 忽略一下文件的显示
let NERDTreeIgnore=['\.pyc','\~$','\.swp']
" 显示书签列表
let NERDTreeShowBookmarks=1
" 使用F2键快速调出和隐藏它
map <F2> :NERDTreeToggle<CR>
" 关闭vim时,如果打开的文件除了NERDTree没有其他文件时,它自动关闭,减少多次按:q!
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif
"---------------------------------------------------------------
"开发的过程中,我们希望git信息直接在NERDTree中显示出来, 和Eclipse一样,修改的文件和增加的文件都给出相应的标注, 这时需要安装的插件就是 nerdtree-git-plugin
let 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 ~/.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'
" 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
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
"source $VIMRUNTIME/mswin.vim
"behave mswin
set ruler
"set nu
syntax on
syntax enable
set ts=4
set noerrorbells
set sw=4
"set autoindent
"set smartindent
filetype on
set foldlevel=100
"set ignorecase smartcase
set so=5
colo desert
autocmd FileType c,py setl fdm=syntax | setl fen
"let g:sh_fold_enabled= 1
set nobackup
"set cursorline
"set cursorcolumn
:runtime macros/matchit.vim
au BufNewFile,BufRead *.t2t set ft=txt2tags
"set foldcolumn=4
set mouse-=a
nmap # I#<Esc>j
map <CTRL-n> :tabnew<CR>
set encoding=utf-8
set termencoding=utf-8
set fileencodings=ucs-bom,utf-8,gb18030,gbk,gb2312,big5,euc-jp,euc-kr,latin1,cp936
autocmd 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() | endif
autocmd BufNewFile,BufRead *.py exec ":call SetTable()"
func SetTable()
set expandtab
set tabstop=4
set shiftwidth=4
endfunc
func 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
endif
endfunc
func 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"))
endif
endfunc