# HG changeset patch # User Ludovic Chabant # Date 1408753169 25200 # Node ID 4bd15b5afcfc2ab7118d22201302479ba9175ea0 # Parent 816866d76ce6cba1780074fd5407bde112336fbd Some cleanup and improvements to `vimrc`. diff -r 816866d76ce6 -r 4bd15b5afcfc vim/vimrc --- 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 1 yypVr=:redraw + autocmd FileType markdown nnoremap 2 yypVr-:redraw + autocmd FileType markdown nnoremap 3 mzI###`z4l + autocmd FileType markdown nnoremap 4 mzI####`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 :call 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 :call StripTrailingWhitespaces() +augroup END " }}} @@ -394,12 +423,6 @@ " Simple way to close a buffer without closing the window. nnoremap bd :bprevious:bdelete # -" Toggle folds with . -nnoremap za - -" Create folds with (in visual mode). -vnoremap zf - " File-type switching. nnoremap ftmd :set ft=markdown @@ -419,6 +442,19 @@ " }}} +" Folding {{{ + +" Always start with all folds closed. +set foldlevelstart=0 + +" Toggle folds with . +nnoremap za + +" Create folds with (in visual mode). +vnoremap 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'