X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=vimrc;h=12ff138f80cb239ab9bd487fbd5b7e24c3b7dd08;hb=49f77fa2e04f15e20800f18e4f91296aa99d2153;hp=3b1ca66256af8e87d772eaf2dc6b94e533f3d804;hpb=d2966139243e247e8fc3e07b6e9c8bae71330087;p=config%2Fdotfiles.git diff --git a/vimrc b/vimrc index 3b1ca66..12ff138 100644 --- a/vimrc +++ b/vimrc @@ -88,6 +88,23 @@ if has('autocmd') endif +" HELPER FUNCTIONS + +" Check if the given syntax group is available. Thanks to bairui in #vim on +" Freenode (2012-02-19 01:15 CET) for the try/catch silent highlight idea. +if has('eval') + function! s:HasSyntaxGroup(group) + try + execute 'silent highlight ' . a:group + " \a = [A-Za-z] + catch /^Vim\%((\a\+)\)\=:E411/ " 'highlight group not found' + return 0 + endtry + return 1 + endfunction +endif + + " EDIT SETTINGS " Enable automatic file detection, plugin and indention support. @@ -218,6 +235,14 @@ if v:version >= 700 set listchars+=nbsp:! endif +" Don't draw the vertical split separator by using space as character. Thanks +" to scp1 in #vim on Freenode (2012-06-16 16:12 CEST) for the idea to use a +" non-breakable space. But a simple space works as well, as long as the +" current color scheme is not reset. +if has('windows') && has('folding') + set fillchars+=vert:\ " comment to prevent trailing whitespace +endif + if has('statusline') " Always display the status line even if there is only one window. set laststatus=2 @@ -348,7 +373,7 @@ nmap - " Go to next and previous buffer. Thanks to elik in #vim on Freenode " (2010-05-16 18:38 CEST) for this idea. nnoremap gb :bnext -nnoremap gB :bprev +nnoremap gB :bprevious " Fast access to buffers. nnoremap 1 :1buffer @@ -485,9 +510,11 @@ endif " ABBREVIATIONS -" Fix some of my spelling mistakes. -iabbrev relle reelle -iabbrev reele reelle +" Fix some of my spelling mistakes (German). +inoreabbrev relle reelle +inoreabbrev reele reelle +" Fix some of my spelling mistakes (English). +inoreabbrev completly completely " SYNTAX SETTINGS @@ -527,7 +554,13 @@ if has('syntax') " from the Vim mailing list. It can easily be " disabled when necessary with :2match (in Vim >= 700). if !&diff && exists(':2match') - 2match Todo /\%>78v./ + " Use ColorColumn for overlong lines if available and my color + " scheme is used. + if &t_Co == 256 && HasSyntaxGroup('ColorColumn') + 2match ColorColumn /\%>78v./ + else + 2match Todo /\%>78v./ + endif elseif !&diff match Todo /\%>78v./ endif @@ -552,6 +585,11 @@ if has('syntax') execute ' for l:x in l:spaces' \ '| call matchadd("Error", "\\%u" . l:x)' \ '| endfor' + +" Reduce visibility of tabs in contrast to normal SpecialKeys. + if &t_Co == 256 && HasSyntaxGroup('specialKeyTab') + call matchadd('specialKeyTab', '\t') + endif endif endfunction " Enable highlights for the current and all new windows. Thanks to bairui in @@ -565,6 +603,8 @@ if has('syntax') " Settings for specific filetypes. + " C + let g:c_no_if0_fold = 1 " fix weird double fold in #if0 in recent versions " Haskell. let g:hs_highlight_delimiters = 1 let g:hs_highlight_boolean = 1 @@ -599,11 +639,17 @@ if has('eval') silent! execute 'call pathogen#runtime_append_all_bundles()' endif +" Settings for securemodelines. + " Only allow items I need (also includes spl which is not enabled by + " default). + let g:secure_modelines_allowed_items = ['ft', 'spl', 'fdm', + \ 'sw', 'sts', 'noet'] + " Settings for the NERD commenter. " Don't create any mappings I don't want to use. let g:NERDCreateDefaultMappings = 0 " Map toggle comment. - map NERDCommenterToggle + nmap NERDCommenterToggle " XPTemplate settings. " Try to maintain snippet rendering even after editing outside of a