一、~/.vimrc 文件内容:
set nocompatible " required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'tmhedberg/SimpylFold'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/nerdcommenter' " commenter: \cc \cu
Plugin 'vim-scripts/indentpython.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'nvie/vim-flake8'
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
call vundle#end() " required
filetype plugin indent on " required
set nuset foldmethod=indentau BufWinLeave * silent mkview " 保存文件的折叠状态au BufRead * silent loadview " 恢复文件的折叠状态nnoremapza " 用空格来切换折叠状态nnoremap" Ctrl+N 打开/关闭map:NERDTreeToggle" 当不带参数打开Vim时自动加载项目树
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" 当所有文件关闭时关闭项目树窗格
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif" 不显示这些文件let NERDTreeIgnore=['\.pyc
, '\~
, 'node_modules'] "ignore files in NERDTree" 不显示项目树上额外的信息,例如帮助、提示什么的let NERDTreeMinimalUI=1let g:ctrlp_working_path_mode = 'ra'set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)
, 'file': '\v\.(exe|so|dll)
}set pastetoggle=set guifont=Inconsolata\ for\ Powerline:h15let g:Powerline_symbols = 'fancy'set encoding=utf-8set t_Co=256set fillchars+=stl:\ ,stlnc:\set term=xterm-256colorset termencoding=utf-8let mapleader=';'let g:SimpylFold_docstring_preview=1let g:ycm_autoclose_preview_window_after_completion=1mapg :YcmCompleter GoToDefinitionElseDeclarationau BufNewFile,BufRead *.py "pthon编码风格
\ set tabstop=4
\ set softtabstop=4
\ set shiftwidth=4
\ set textwidth=79
\ set expandtab
\ set autoindent
\ set fileformat=unix
"au BufNewFile,BufRead *.js, *.html, *.css
"\ set tabstop=2
"\ set softtabstop=2
"\ set shiftwidth=2
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
set encoding=utf-8
"python with virtualenv support
"py << EOF
"import os
"import sys
"if 'VIRTUAL_ENV' in os.environ:
" project_base_dir = os.environ['VIRTUAL_ENV']
" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
" execfile(activate_this, dict(__file__=activate_this))
" EOF
let python_highlight_all=1
syntax on
if has('gui_running')
set background=dark
colorscheme solarized
else
colorscheme Zenburn
endif
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
set clipboard=unnamed
"bash setting
autocmd BufNewFile *.py,*.sh, exec ":call SetTitle()"
let $author_name = "Aaron.Ren"
let $author_email = "kyednal@foxmail.com"
func SetTitle()
if &filetype == 'sh'
call setline(1,"\###################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: ".$author_name)
call append(line(".")+2, "\# mail: ".$author_email)
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\##################################################################")
call append(line(".")+5, "\#!/bin/bash")
call append(line(".")+6, "")
else
call setline(1,"\###################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: ".$author_name)
call append(line(".")+2, "\# mail: ".$author_email)
call append(line(".")+3, "\# Created Time: ".strftime("%c"))
call append(line(".")+4, "\###################################################################")
call append(line(".")+5, "\#!/bin/python")
call append(line(".")+6, "\# -*- coding:utf-8 -*-")
call append(line(".")+7, "")
endif
endfunc