1
0

vimrc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. if filereadable("/usr/share/vim/google/google.vim")
  2. source /usr/share/vim/google/google.vim
  3. endif
  4. " Welcome to Vim (http://go/vim).
  5. " Plugin configuration.
  6. " See http://google3/devtools/editors/vim/examples/ for example configurations
  7. " and http://go/vim/plugins for more information about vim plugins at Google.
  8. " Plugin loading is commented out below - uncomment the plugins you'd like to
  9. " load.
  10. " Load google's formatting plugins (http://go/vim/plugins/codefmt-google).
  11. " The default mapping is \= (or <leader>= if g:mapleader has a custom value),
  12. " with
  13. " - \== formatting the current line or selected lines in visual mode
  14. " (:FormatLines).
  15. " - \=b formatting the full buffer (:FormatCode).
  16. "
  17. " To bind :FormatLines to the same key in insert and normal mode, add:
  18. " noremap <C-K> :FormatLines<CR>
  19. " inoremap <C-K> <C-O>:FormatLines<CR>
  20. "Glug codefmt plugin[mappings] gofmt_executable="goimports"
  21. "Glug codefmt-google
  22. " Enable autoformatting on save for the languages at Google that enforce
  23. " formatting, and for which all checked-in code is already conforming (thus,
  24. " autoformatting will never change unrelated lines in a file).
  25. " Note formatting changed lines only isn't supported yet
  26. " (see https://github.com/google/vim-codefmt/issues/9).
  27. "augroup autoformat_settings
  28. " autocmd FileType bzl AutoFormatBuffer buildifier
  29. " autocmd FileType go AutoFormatBuffer gofmt
  30. " See go/vim/plugins/codefmt-google, :help codefmt-google and :help codefmt
  31. " for details about other available formatters.
  32. "augroup END
  33. " Load YCM (http://go/ycm) for semantic auto-completion and quick syntax
  34. " error checking. Pulls in a google3-enabled version of YCM itself and
  35. " a google3-specific default configuration.
  36. "Glug youcompleteme-google
  37. " Load the automated blaze dependency integration for Go.
  38. " Note: for Go, blazedeps uses the Go team's glaze tool, which is fully
  39. " supported by the Go team. The plugin is currently unsupported for other
  40. " languages.
  41. "Glug blazedeps auto_filetypes=`['go']`
  42. " Load piper integration (http://go/VimPerforce).
  43. "Glug piper plugin[mappings]
  44. " Load Critique integration. Use :h critique for more details.
  45. "Glug critique plugin[mappings]
  46. " Load blaze integration (http://go/blazevim).
  47. "Glug blaze plugin[mappings]
  48. " Load the syntastic plugin (http://go/vim/plugins/syntastic-google).
  49. " Note: this requires installing the upstream syntastic plugin from
  50. " https://github.com/vim-syntastic/syntastic.
  51. "Glug syntastic-google
  52. " Load the ultisnips plugin (http://go/ultisnips).
  53. " Note: this requires installing the upstream ultisnips plugin from
  54. " https://github.com/SirVer/ultisnips.
  55. "Glug ultisnips-google
  56. " All of your plugins must be added before the following line.
  57. " See go/vim-plugin-manager if you need help picking a plugin manager and
  58. " setting it up.
  59. set vb t_vb=
  60. set backspace=indent,eol,start
  61. set incsearch
  62. set smartcase
  63. set ignorecase
  64. set hlsearch
  65. set nowrapscan
  66. set nowrap
  67. set scrolloff=5
  68. set sidescroll=1
  69. set sidescrolloff=10
  70. set tabstop=4
  71. set shiftwidth=4
  72. set wildmode=longest:list
  73. set background=dark
  74. set spelllang=en_us
  75. set foldminlines=2
  76. set foldlevelstart=1
  77. set foldnestmax=2
  78. set foldmethod=syntax
  79. set modeline
  80. set keywordprg=man\ -s
  81. set mouse=
  82. set linebreak
  83. set formatoptions-=o
  84. set ruler
  85. set laststatus=1
  86. set nojoinspaces
  87. set fileformats=unix,dos,mac
  88. set t_Co=256
  89. set completeopt=menuone
  90. set tags=tags;
  91. set backupdir=$HOME/.vim_swap//,/tmp
  92. set directory=$HOME/.vim_swap//,/tmp
  93. set guicursor=
  94. map <ESC>u :nohlsearch<CR>
  95. map j gj
  96. map k gk
  97. map Q ZQ
  98. map H za
  99. map \l :w<CR>:make<CR>
  100. map - $
  101. map _ ct_
  102. map <C-n> gt
  103. map <C-p> gT
  104. map <C-h> :AS<CR>
  105. nmap <Tab> :set expandtab!<CR>:set expandtab?<CR>
  106. nmap <Insert> :set paste!<CR>:set paste?<CR>
  107. nmap <C-j> :lnext<cr>
  108. nmap <C-k> :lprevious<cr>
  109. vmap P "_dP
  110. inoremap <C-d> <C-t>
  111. inoremap <C-a> <C-d>
  112. let g:mundo_prefer_python3 = 1
  113. nnoremap U :MundoToggle<CR>
  114. let g:syntastic_python_checkers = ['pyflakes']
  115. let g:syntastic_always_populate_loc_list = 1
  116. let g:syntastic_auto_loc_list = 1
  117. let g:syntastic_check_on_open = 0
  118. let g:syntastic_check_on_wq = 0
  119. let g:syntastic_mode_map = {'mode': 'passive', 'active_filetypes': [], 'passive_filetypes': []}
  120. let g:syntastic_enable_signs = 0
  121. nmap <F11> :SyntasticCheck<cr>
  122. nmap <F12> :SyntasticReset<cr>
  123. let g:ctrlp_map = '<c-o>'
  124. let g:ctrlp_match_func = {'match': 'pymatcher#PyMatch'}
  125. let g:rust_recommended_style = 0
  126. let g:rust_fold = 1
  127. filetype plugin indent on
  128. syntax on
  129. highlight Folded ctermbg=black
  130. highlight Todo ctermbg=none ctermfg=lightcyan
  131. " for ft=gitcommit
  132. highlight DiffRemoved ctermfg=red cterm=bold
  133. highlight DiffAdded ctermfg=green cterm=bold
  134. " for vimdiff
  135. highlight DiffAdd ctermfg=black ctermbg=green
  136. highlight DiffDelete ctermfg=black ctermbg=red
  137. highlight DiffChange ctermbg=darkgray
  138. highlight DiffText ctermfg=black ctermbg=yellow
  139. au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
  140. au BufNewFile,BufRead *.jinja2 set ft=htmldjango
  141. au BufNewFile,BufRead *.ccss set ft=clevercss
  142. au BufNewFile,BufRead *.pp set ft=puppet foldmethod=indent
  143. autocmd FileType c,cpp,perl,php,java,glsl set cindent foldmethod=syntax
  144. autocmd FileType python set autoindent foldmethod=indent
  145. autocmd FileType ruby set foldmethod=indent foldnestmax=4
  146. autocmd FileType sh set autoindent foldmethod=syntax
  147. autocmd FileType go set foldmethod=syntax foldlevel=0 foldnestmax=1
  148. autocmd FileType javascript,less,html set foldnestmax=3 formatoptions-=o
  149. autocmd FileType javascript,less set foldmethod=indent
  150. autocmd FileType tex,latex set wrap showbreak=+ spell makeprg=pdflatex\ -interaction=nonstopmode\ %
  151. autocmd FileType tf set foldmethod=indent foldlevel=0
  152. autocmd FileType html,htmldjango,sml set autoindent
  153. autocmd FileType man set nomod nolist readonly
  154. autocmd FileType man map q :q<CR>
  155. autocmd FileType diff map H zA
  156. autocmd FileType diff map L za
  157. autocmd FileType bzl set foldmethod=indent foldnestmax=3 foldlevel=2
  158. autocmd FileType proto set foldmethod=syntax
  159. autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
  160. autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif