changeset 204:4bd15b5afcfc

Some cleanup and improvements to `vimrc`.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 22 Aug 2014 17:19:29 -0700
parents 816866d76ce6
children 477efa0013fd
files vim/vimrc
diffstat 1 files changed, 70 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/vim/vimrc	Thu Aug 21 15:57:41 2014 -0700
+++ b/vim/vimrc	Fri Aug 22 17:19:29 2014 -0700
@@ -243,9 +243,6 @@
 
 " Use `pyflakes` with `syntastic`.
 let g:syntastic_python_checkers = ['pyflakes']
-let g:syntastic_mode_map = {
-            \'mode': 'active',
-            \'passive_filetypes': []}
 
 " }}}
 
@@ -277,7 +274,20 @@
 
 " Python-Mode {{{
 
-let g:pymode = 0
+let g:pymode = 1
+let g:pymode_python = 'disable'
+let g:pymode_syntax_all = 1
+let g:pymode_syntax_print_as_function = 1
+let g:pymode_syntax_space_errors = 1
+let g:pymode_run = 0
+let g:pymode_lint = 0
+let g:pymode_trim_whitespaces = 0
+let g:pymode_virtualenv = 0
+let g:pymode_folding = 1
+
+if !has('python')
+    let g:pymode = 0
+endif
 
 " }}}
 
@@ -285,36 +295,55 @@
 
 " File-Specific Settings {{{
 
-if has("autocmd")
-
-    augroup VimRCAutoCWD
-        au!
+" Automatically change the current working directory based on a project
+" I'm in.
+augroup VimRCAutoCWD
+    au!
+    autocmd BufEnter * call s:SetProjectRootCwd()
+augroup END
 
-        autocmd BufEnter * call s:SetProjectRootCwd()
-    augroup END
+augroup VimRCFileType_markdown
+    au!
+    autocmd FileType text,markdown setlocal textwidth=80
+    autocmd FileType markdown nnoremap <buffer> <localleader>1 yypVr=:redraw<cr>
+    autocmd FileType markdown nnoremap <buffer> <localleader>2 yypVr-:redraw<cr>
+    autocmd FileType markdown nnoremap <buffer> <localleader>3 mzI###<space><esc>`z4l
+    autocmd FileType markdown nnoremap <buffer> <localleader>4 mzI####<space><esc>`z5l
 
-    augroup VimRCFileTypeSettings
-        au!
-    
-        " Nice text width for text files.
-        autocmd FileType text,markdown setlocal textwidth=80
+    autocmd BufRead,BufNewfile */Dropbox/Personal/SimpleNote/* set ft=markdown
+    autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown
+augroup END
+
+augroup VimRCFileType_php
+    au!
+    " Who the hell changes my matchpairs?
+    autocmd FileType php setlocal matchpairs-=<:>
+augroup END
 
-        " Who the hell changes my matchpairs?
-        autocmd FileType php setlocal matchpairs-=<:>
-
-        " File I know are markdown: personal notes & PieCrust pages.
-        autocmd BufRead,BufNewfile */Dropbox/Personal/SimpleNote/* set ft=markdown
-        autocmd BufRead,BufNewFile */_content/**/*.html set ft=piecrustmarkdown
+augroup VimRCFileType_c
+    au!
+    autocmd FileType c,c++ setlocal foldmethod=marker foldmarker={,}
+augroup END
 
-    augroup END
-
-    augroup VimRCTrailingWhitespaces
-        au!
+augroup VimRCFileType_css
+    au!
+    autocmd BufNewFile,BufRead *.less setlocal filetype=less
+    autocmd Filetype less,css setlocal foldmethod=marker
+    autocmd Filetype less,css setlocal foldmarker={,}
+    autocmd Filetype less,css setlocal iskeyword+=-
+    autocmd Filetype less,css setlocal omnifunc=csscomplete#CompleteCSS
+augroup END
 
-        autocmd FileType c,cpp,java,php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
-    augroup END       
+augroup VimRCFileType_python
+    au!
+    autocmd FileType python setlocal define=\\v^\\s*(def\|class)\\s+
+    "autocmd FileType python if exists('python_space_error_highlight')|unlet python_space_error_highlight|endif
+augroup END
 
-endif
+augroup VimRCTrailingWhitespaces
+    au!
+    autocmd FileType c,cpp,java,php,ruby,python,js,css,less autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
+augroup END       
 
 " }}}
 
@@ -394,12 +423,6 @@
 " Simple way to close a buffer without closing the window.
 nnoremap <leader>bd :bprevious<cr>:bdelete #<cr>
 
-" Toggle folds with <space>.
-nnoremap <space> za
-
-" Create folds with <space> (in visual mode).
-vnoremap <space> zf
-
 " File-type switching.
 nnoremap <leader>ftmd :set ft=markdown<cr>
 
@@ -419,6 +442,19 @@
 
 " }}}
 
+" Folding {{{
+
+" Always start with all folds closed.
+set foldlevelstart=0
+
+" Toggle folds with <space>.
+nnoremap <space> za
+
+" Create folds with <space> (in visual mode).
+vnoremap <space> zf
+
+" }}}
+
 " Abbreviations {{{
 
 iabbrev @@      ludovic@chabant.com
@@ -550,23 +586,6 @@
 
 " }}}
 
-" Temporary stuff {{{
-
-" Enable debugging Lawrencium
-let g:lawrencium_debug = 1
-let g:lawrencium_trace = 0
-
-command! LawrenciumEnableTrace  :call lawrencium#debugtrace(1)
-command! LawrenciumDisableTrace :call lawrencium#debugtrace(0)
-
-let g:autotags_debug = 1
-
-" Enable debugging PieCrust
-let g:piecrust_debug = 1
-let g:piecrust_trace = 0
-
-" }}}
-
 " Local override {{{
 
 let s:local_vimrc = s:vim_home.'/vimrc-local'