Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
205 lines (162 sloc) 5.6 KB
autocmd!
set nocompatible " We're running Vim, not Vi!
set exrc " extra in-folder vimrc support
set encoding=utf-8 " Necessary to show Unicode glyphs
" set for vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'VundleVim/Vundle.vim'
" My Bundles here:
"
" original repos on github
" Theme
Plugin 'chriskempson/base16-vim'
" IDE
Plugin 'scrooloose/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'ervandew/supertab'
Plugin 'scrooloose/nerdcommenter'
Plugin 'jeetsukumaran/vim-buffergator'
Plugin 'rking/ag.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'easymotion/vim-easymotion'
Plugin 'bling/vim-airline'
Plugin 'vim-scripts/ZoomWin'
Plugin 'vim-scripts/Align'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
Plugin 'scrooloose/syntastic'
" Git
Plugin 'tpope/vim-fugitive'
" Language
Plugin 'vim-ruby/vim-ruby'
Plugin 'ecomba/vim-ruby-refactoring'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-bundler'
Plugin 'slim-template/vim-slim'
Plugin 'mattn/emmet-vim'
Plugin 'pangloss/vim-javascript'
Plugin 'kchmck/vim-coffee-script'
Plugin 'othree/javascript-libraries-syntax.vim'
" tmux integration
Plugin 'christoomey/vim-tmux-navigator'
" rust
Plugin 'rust-lang/rust.vim'
Plugin 'cespare/vim-toml'
Plugin 'timonv/vim-cargo'
call vundle#end() " required
filetype plugin indent on " required
set nobackup " do not keep a backup file, use verions instead
set history=2000
set showcmd " display incomplete commands
set expandtab
set tabstop=2 shiftwidth=2 softtabstop=2
set autoindent
set number
set hlsearch " 所有匹配的keyword都会高亮
set incsearch " do incremental searching 实时匹配
set ruler " 在右下角显示光标位置的状态行
set backspace=indent,eol,start " 可删除自动缩进,可以删除行首,可以删除此次插入前的输入
set guioptions=m " Remove menu bar
set guioptions=r
map Q gq " Don't use Ex mode, use Q for formating
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
set dictionary+=/usr/share/dict/words
set t_Co=256 " for colorscheme in iTerm 2, link: http://stackoverflow.com/questions/3761770/iterm-vim-colorscheme-not-working
syntax on " Enable syntax highlighting if terminal supports
syntax sync fromstart
if filereadable(expand("~/.vimrc_background"))
let base16colorspace=256
source ~/.vimrc_background
endif
set guifont=Hack\ Regular:h12
colorscheme base16-default-dark
filetype off
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
set cst
" remap leader key
let mapleader = ","
" for ack
set grepprg=ag\ --nogroup\ --nocolor
nmap <leader>f :Ag<space>
" for CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_use_caching = 0
let g:ctrlp_clear_cache_on_exit = 0
set wildignore+=*/tmp/*,*.so,*.swp,*.swo,*.zip,*/vendor,*/.DS_Store,*.log " MacOSX/Linux
let g:ctrlp_custom_ignore = {
\ 'dir': '|\.git\|node_modules\|bin\|\.hg\|\.svn\|build\|resources\|coverage\|doc\|tmp\|public/assets\|vendor\|Android',
\ 'file': '\.jpg$\|\.exe$\|\.so$\|tags$\|\.dll$'
\ }
" for NERDTree
map <leader>n :NERDTreeToggle<CR>
" for tagbar
map <leader>rt :TagbarToggle<CR>
" for buffergator
let g:buffergator_viewport_split_policy = "T"
" for syntastic
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
"let g:syntastic_error_symbol = "✗"
"let g:syntastic_warning_symbol = "⚠"
"nmap <leader>s :SyntasticToggleMode<CR>
" for Fugitive
nmap <leader>gb :Gblame<CR>
nmap <leader>gs :Gstatus<CR>
nmap <leader>gd :Gdiff<CR>
nmap <leader>gl :Glog<CR>
" for snipetMate
autocmd BufNewFile,BufRead *.html.erb set filetype=html.ruby
autocmd BufNewFile,BufRead *.builder set filetype=ruby
" for rvm in macvim
set shell=/bin/sh
" Strip trailing whitespace
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
runtime macros/matchit.vim
" fixed vim display incorrect with tmux, refer: http://stackoverflow.com/questions/20328984/vim-windows-corrupted-under-tmux
let g:NERDTreeDirArrows = 0
let g:NERDTreeWinSize=40
" Open NERDTree automatically when vim stars up with no file specify
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" close vim if there's only winlow left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Supertab use omni completion default
let g:SuperTabDefaultCompletionType = 'context'
autocmd FileType * if (&omnifunc != '') | call SuperTabChain(&omnifunc, "<c-p>") | endif
" Make those debugger statements painfully obvious
au BufEnter *.rb syn match error contained "\<binding.pry\>"
au BufEnter *.rb syn match error contained "\<debugger\>"
" for tmux copy
set clipboard+=unnamed
" for cargo
map <c-r> :CargoRun<kEnter>