Mercurial > dotfiles
comparison vim/vimrc @ 204:4bd15b5afcfc
Some cleanup and improvements to `vimrc`.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 22 Aug 2014 17:19:29 -0700 |
parents | 0db3b41793ee |
children | 477efa0013fd |
comparison
equal
deleted
inserted
replaced
203:816866d76ce6 | 204:4bd15b5afcfc |
---|---|
241 | 241 |
242 " Syntastic {{{ | 242 " Syntastic {{{ |
243 | 243 |
244 " Use `pyflakes` with `syntastic`. | 244 " Use `pyflakes` with `syntastic`. |
245 let g:syntastic_python_checkers = ['pyflakes'] | 245 let g:syntastic_python_checkers = ['pyflakes'] |
246 let g:syntastic_mode_map = { | |
247 \'mode': 'active', | |
248 \'passive_filetypes': []} | |
249 | 246 |
250 " }}} | 247 " }}} |
251 | 248 |
252 " Lawrencium {{{ | 249 " Lawrencium {{{ |
253 | 250 |
275 | 272 |
276 " }}} | 273 " }}} |
277 | 274 |
278 " Python-Mode {{{ | 275 " Python-Mode {{{ |
279 | 276 |
280 let g:pymode = 0 | 277 let g:pymode = 1 |
278 let g:pymode_python = 'disable' | |
279 let g:pymode_syntax_all = 1 | |
280 let g:pymode_syntax_print_as_function = 1 | |
281 let g:pymode_syntax_space_errors = 1 | |
282 let g:pymode_run = 0 | |
283 let g:pymode_lint = 0 | |
284 let g:pymode_trim_whitespaces = 0 | |
285 let g:pymode_virtualenv = 0 | |
286 let g:pymode_folding = 1 | |
287 | |
288 if !has('python') | |
289 let g:pymode = 0 | |
290 endif | |
281 | 291 |
282 " }}} | 292 " }}} |
283 | 293 |
284 " }}} | 294 " }}} |
285 | 295 |
286 " File-Specific Settings {{{ | 296 " File-Specific Settings {{{ |
287 | 297 |
288 if has("autocmd") | 298 " Automatically change the current working directory based on a project |
289 | 299 " I'm in. |
290 augroup VimRCAutoCWD | 300 augroup VimRCAutoCWD |
291 au! | 301 au! |
292 | 302 autocmd BufEnter * call s:SetProjectRootCwd() |
293 autocmd BufEnter * call s:SetProjectRootCwd() | 303 augroup END |
294 augroup END | 304 |
295 | 305 augroup VimRCFileType_markdown |
296 augroup VimRCFileTypeSettings | 306 au! |
297 au! | 307 autocmd FileType text,markdown setlocal textwidth=80 |
298 | 308 autocmd FileType markdown nnoremap <buffer> <localleader>1 yypVr=:redraw<cr> |
299 " Nice text width for text files. | 309 autocmd FileType markdown nnoremap <buffer> <localleader>2 yypVr-:redraw<cr> |
300 autocmd FileType text,markdown setlocal textwidth=80 | 310 autocmd FileType markdown nnoremap <buffer> <localleader>3 mzI###<space><esc>`z4l |
301 | 311 autocmd FileType markdown nnoremap <buffer> <localleader>4 mzI####<space><esc>`z5l |
302 " Who the hell changes my matchpairs? | 312 |
303 autocmd FileType php setlocal matchpairs-=<:> | 313 autocmd BufRead,BufNewfile */Dropbox/Personal/SimpleNote/* set ft=markdown |
304 | 314 autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown |
305 " File I know are markdown: personal notes & PieCrust pages. | 315 augroup END |
306 autocmd BufRead,BufNewfile */Dropbox/Personal/SimpleNote/* set ft=markdown | 316 |
307 autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown | 317 augroup VimRCFileType_php |
308 | 318 au! |
309 augroup END | 319 " Who the hell changes my matchpairs? |
310 | 320 autocmd FileType php setlocal matchpairs-=<:> |
311 augroup VimRCTrailingWhitespaces | 321 augroup END |
312 au! | 322 |
313 | 323 augroup VimRCFileType_c |
314 autocmd FileType c,cpp,java,php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() | 324 au! |
315 augroup END | 325 autocmd FileType c,c++ setlocal foldmethod=marker foldmarker={,} |
316 | 326 augroup END |
317 endif | 327 |
328 augroup VimRCFileType_css | |
329 au! | |
330 autocmd BufNewFile,BufRead *.less setlocal filetype=less | |
331 autocmd Filetype less,css setlocal foldmethod=marker | |
332 autocmd Filetype less,css setlocal foldmarker={,} | |
333 autocmd Filetype less,css setlocal iskeyword+=- | |
334 autocmd Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS | |
335 augroup END | |
336 | |
337 augroup VimRCFileType_python | |
338 au! | |
339 autocmd FileType python setlocal define=\\v^\\s*(def\|class)\\s+ | |
340 "autocmd FileType python if exists('python_space_error_highlight')|unlet python_space_error_highlight|endif | |
341 augroup END | |
342 | |
343 augroup VimRCTrailingWhitespaces | |
344 au! | |
345 autocmd FileType c,cpp,java,php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces() | |
346 augroup END | |
318 | 347 |
319 " }}} | 348 " }}} |
320 | 349 |
321 " Mappings {{{ | 350 " Mappings {{{ |
322 | 351 |
392 nnoremap <C-l>s :call <SID>ToggleSpellCheck()<cr> | 421 nnoremap <C-l>s :call <SID>ToggleSpellCheck()<cr> |
393 | 422 |
394 " Simple way to close a buffer without closing the window. | 423 " Simple way to close a buffer without closing the window. |
395 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> | 424 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> |
396 | 425 |
397 " Toggle folds with <space>. | |
398 nnoremap <space> za | |
399 | |
400 " Create folds with <space> (in visual mode). | |
401 vnoremap <space> zf | |
402 | |
403 " File-type switching. | 426 " File-type switching. |
404 nnoremap <leader>ftmd :set ft=markdown<cr> | 427 nnoremap <leader>ftmd :set ft=markdown<cr> |
405 | 428 |
406 " Use sane regexes. | 429 " Use sane regexes. |
407 nnoremap / /\v | 430 nnoremap / /\v |
414 let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') | 437 let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') |
415 let @@ = temp | 438 let @@ = temp |
416 endfunction | 439 endfunction |
417 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o> | 440 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR><c-o> |
418 vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o> | 441 vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR><c-o> |
442 | |
443 " }}} | |
444 | |
445 " Folding {{{ | |
446 | |
447 " Always start with all folds closed. | |
448 set foldlevelstart=0 | |
449 | |
450 " Toggle folds with <space>. | |
451 nnoremap <space> za | |
452 | |
453 " Create folds with <space> (in visual mode). | |
454 vnoremap <space> zf | |
419 | 455 |
420 " }}} | 456 " }}} |
421 | 457 |
422 " Abbreviations {{{ | 458 " Abbreviations {{{ |
423 | 459 |
548 endif | 584 endif |
549 endfunction | 585 endfunction |
550 | 586 |
551 " }}} | 587 " }}} |
552 | 588 |
553 " Temporary stuff {{{ | |
554 | |
555 " Enable debugging Lawrencium | |
556 let g:lawrencium_debug = 1 | |
557 let g:lawrencium_trace = 0 | |
558 | |
559 command! LawrenciumEnableTrace :call lawrencium#debugtrace(1) | |
560 command! LawrenciumDisableTrace :call lawrencium#debugtrace(0) | |
561 | |
562 let g:autotags_debug = 1 | |
563 | |
564 " Enable debugging PieCrust | |
565 let g:piecrust_debug = 1 | |
566 let g:piecrust_trace = 0 | |
567 | |
568 " }}} | |
569 | |
570 " Local override {{{ | 589 " Local override {{{ |
571 | 590 |
572 let s:local_vimrc = s:vim_home.'/vimrc-local' | 591 let s:local_vimrc = s:vim_home.'/vimrc-local' |
573 if filereadable(s:local_vimrc) | 592 if filereadable(s:local_vimrc) |
574 execute 'source' s:local_vimrc | 593 execute 'source' s:local_vimrc |