我的vim配置文件,使用Vundle管理插件



" ~/.vimrc  2017

" --------------------------------------------------
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" Launch vim and run :PluginInstall
" To install from command line: vim +PluginInstall +qall
" learn more: https://github.com/VundleVim/Vundle.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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" --------------------------------------------------
Plugin 'sickill/vim-monokai'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'kien/ctrlp.vim'
" Plugin 'Yggdroot/indentLine'
" Plugin 'tmhedberg/SimpylFold'
" Plugin 'scrooloose/nerdtree'
" Plugin 'tpope/vim-surround'
" Plugin 'ervandew/supertab'
" Plugin 'sirver/ultisnips'
" --------------------------------------------------

" 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
" --------------------------------------------------


" --------------------------------------------------
" for simpylfold
" let g:SimpylFold_docstring_preview = 1
" let g:SimpylFold_fold_import = 0
" autocmd BufWinEnter *.py setlocal foldexpr=SimpylFold(v:lnum) foldmethod=expr
" autocmd BufWinLeave *.py setlocal foldexpr< foldmethod<
" --------------------------------------------------


" --------------------------------------------------
"  for vim color theme
" set t_Co=256 " not required in monokai
syntax on
set bg=dark
colorscheme monokai
" --------------------------------------------------


" --------------------------------------------------
set laststatus=2 " required
let g:airline_theme='simple'
" --------------------------------------------------


" --------------------------------------------------
" basic config
let mapleader = ','
set bs=2
filetype plugin on
set wildmenu
set showmatch
set hlsearch
set ignorecase " ignore case when search
nnoremap ,h :nohl<cr>


" Enable folding with the spacebar
" nnoremap <space> za


" for NerdTree
" nnoremap <C-t> :NERDTreeToggle<CR>
" let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree


" for paste
nnoremap ,p :setlocal paste! paste?<cr>i


set tabstop=4
set softtabstop=4
set shiftwidth=4
set cindent
set autoindent
set smartindent
set history=1000
set undolevels=1000
set autoread
set cursorline
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1

" all tab auto replace by space, but no change to existed tab
" to convert exited tab use :retab
set expandtab

" macos clipboard
set clipboard=unnamed

" Enable folding
" set foldmethod=indent
" set foldlevel=99


" for python
au BufNewFile,BufRead *.py
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |
    \ set textwidth=99 |
    \ set expandtab |
    \ set autoindent |
    \ set fileformat=unix |


" for js html css
au BufNewFile,BufRead *.js,*.html,*.css
    \ set tabstop=4 |
    \ set softtabstop=4 |
    \ set shiftwidth=4 |


" make sure vim returns to the same line when you reopen a file
augroup line_return
    au!
    au BufReadPost *
        \ if line("'\"") > 0 && line("'\"") <= line("$") |
        \     execute 'normal! g`"zvzz' |
        \ endif
augroup END


" clean trailing whitespace
nnoremap  ,,  mz:%s/\s\+$//<cr>:let @/=''<cr>`z


" resize splits when the window is resized
au VimResized * :wincmd =


" --------------------------------------------------
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set splitbelow
set splitright
" --------------------------------------------------



" --------------------------------------------------
" no backup
set nobackup
set nowritebackup
set noswapfile
" --------------------------------------------------


" show tab space eol
" set list listchars=tab:▸\ ,trail:•,eol:¬


" Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %
nnoremap ,s :so ~/.vimrc<cr>


" --------------------------------------------------
" textwidth
set number  " show line numbers
set tw=99   " width of document (used by gd)
set nowrap  " don't automatically wrap on load
set fo-=t   " don't automatically wrap text when typing
set colorcolumn=100
" --------------------------------------------------


" --------------------------------------------------
"  airline
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
" --------------------------------------------------

" copy to + register
nnoremap ,copy ggVG"+y