.vimrc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. set nocompatible
  2. " include Vundle
  3. set rtp+=~/.vim/bundle/Vundle.vim
  4. call vundle#begin()
  5. Plugin 'scrooloose/nerdtree'
  6. Plugin 'scrooloose/syntastic'
  7. Plugin 'scrooloose/nerdcommenter'
  8. Plugin 'Xuyuanp/nerdtree-git-plugin'
  9. Plugin 'tpope/vim-fugitive'
  10. Plugin 'airblade/vim-gitgutter'
  11. Plugin 'tpope/vim-surround'
  12. Plugin 'jiangmiao/auto-pairs'
  13. Plugin 'tpope/vim-fugitive'
  14. Plugin 'Lokaltog/vim-easymotion'
  15. call vundle#end()
  16. filetype plugin indent on
  17. " END Vundle
  18. map <C-n> :NERDTreeToggle<CR>
  19. set number
  20. set ruler
  21. syntax on
  22. " Set encoding
  23. set encoding=utf-8
  24. " Whitespace stuff
  25. set nowrap
  26. set tabstop=2
  27. set shiftwidth=2
  28. set softtabstop=2
  29. set expandtab
  30. set list listchars=tab:\ \ ,trail:ยท
  31. " Searching
  32. set hlsearch
  33. set incsearch
  34. set ignorecase
  35. set smartcase
  36. " Tab completion
  37. set wildmode=list:longest,list:full
  38. set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
  39. " Status bar
  40. set laststatus=2
  41. " Without setting this, ZoomWin restores windows in a way that causes
  42. " equalalways behavior to be triggered the next time CommandT is used.
  43. " This is likely a bludgeon to solve some other issue, but it works
  44. set noequalalways
  45. " NERDTree configuration
  46. let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
  47. map <Leader>n :NERDTreeToggle<CR>
  48. " Command-T configuration
  49. let g:CommandTMaxHeight=20
  50. " ZoomWin configuration
  51. map <Leader><Leader> :ZoomWin<CR>
  52. " CTags
  53. map <Leader>rt :!ctags --extra=+f -R *<CR><CR>
  54. map <C-\> :tnext<CR>
  55. " Remember last location in file
  56. if has("autocmd")
  57. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  58. \| exe "normal g'\"" | endif
  59. endif
  60. function s:setupWrapping()
  61. set wrap
  62. set wrapmargin=2
  63. set textwidth=72
  64. endfunction
  65. function s:setupMarkup()
  66. call s:setupWrapping()
  67. map <buffer> <Leader>p :Hammer<CR>
  68. endfunction
  69. " make uses real tabs
  70. au FileType make set noexpandtab
  71. " Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
  72. au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
  73. " md, markdown, and mk are markdown and define buffer-local preview
  74. au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} call s:setupMarkup()
  75. " add json syntax highlighting
  76. au BufNewFile,BufRead *.json set ft=javascript
  77. au BufRead,BufNewFile *.txt call s:setupWrapping()
  78. " make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
  79. au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
  80. " allow backspacing over everything in insert mode
  81. set backspace=indent,eol,start
  82. " load the plugin and indent settings for the detected filetype
  83. filetype plugin indent on
  84. " Opens an edit command with the path of the currently edited file filled in
  85. " Normal mode: <Leader>e
  86. map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
  87. " Opens a tab edit command with the path of the currently edited file filled in
  88. " Normal mode: <Leader>t
  89. map <Leader>te :tabe <C-R>=expand("%:p:h") . "/" <CR>
  90. " Inserts the path of the currently edited file into a command
  91. " Command mode: Ctrl+P
  92. cmap <C-P> <C-R>=expand("%:p:h") . "/" <CR>
  93. " Unimpaired configuration
  94. " Bubble single lines
  95. nmap <C-Up> [e
  96. nmap <C-Down> ]e
  97. " Bubble multiple lines
  98. vmap <C-Up> [egv
  99. vmap <C-Down> ]egv
  100. " Enable syntastic syntax checking
  101. let g:syntastic_enable_signs=1
  102. let g:syntastic_quiet_warnings=1
  103. " gist-vim defaults
  104. if has("mac")
  105. let g:gist_clip_command = 'pbcopy'
  106. elseif has("unix")
  107. let g:gist_clip_command = 'xclip -selection clipboard'
  108. endif
  109. let g:gist_detect_filetype = 1
  110. let g:gist_open_browser_after_post = 1
  111. " Use modeline overrides
  112. set modeline
  113. set modelines=10
  114. " Default color scheme
  115. color sunburst
  116. " Directories for swp files
  117. set backupdir=~/.vim/backup
  118. set directory=~/.vim/backup
  119. " Turn off jslint errors by default
  120. let g:JSLintHighlightErrorLine = 0
  121. " MacVIM shift+arrow-keys behavior (required in .vimrc)
  122. let macvim_hig_shift_movement = 1
  123. " % to bounce from do to end etc.
  124. runtime! macros/matchit.vim
  125. " Show (partial) command in the status line
  126. set showcmd
  127. " Include user's local vim config
  128. if filereadable(expand("~/.vimrc.local"))
  129. source ~/.vimrc.local
  130. endif