X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=blobdiff_plain;f=vim%2Fvimrc;h=86c1e706e8263965107374ae908d8795fbd682eb;hp=e8f19ff6c6cc38cd93b3b37e64384306e2443f1a;hb=0dd903507ae3f0fea3d284418ddad55132070ffb;hpb=00b4c91969f0ee1fd7ea4e87a0b0e1ab9407c87c diff --git a/vim/vimrc b/vim/vimrc index e8f19ff..86c1e70 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -16,6 +16,29 @@ " along with this file. If not, see . +" HELPER FUNCTIONS + +if has('eval') +" 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. + 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 + +" Check if the given Vim version and patch is available. + function! s:HasVersionAndPatch(version, patch) + return v:version > a:version + \ || (v:version == a:version && has('patch' . a:patch)) + endfunction +endif + + " EDITOR SETTINGS " Save 'runtimepath' in case it was changed by the system's configuration @@ -113,9 +136,13 @@ if has('viminfo') set viminfo^='1000 endif -" Use strong encryption if possible, also used for swap/undo files. +" Use strong(er) encryption if possible, also used for swap/undo files. if exists('+cryptmethod') - set cryptmethod=blowfish + if s:HasVersionAndPatch(704, 399) + set cryptmethod=blowfish2 + else + set cryptmethod=blowfish + endif endif " Clear all vimrc-related autocmds. Has to be done here as the vimrc augroup @@ -127,29 +154,6 @@ if has('autocmd') endif -" HELPER FUNCTIONS - -if has('eval') -" 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. - 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 - -" Check if the given Vim version and patch is available. - function! s:HasVersionAndPatch(version, patch) - return v:version > a:version - \ || (v:version == a:version && has('patch' . a:patch)) - endfunction -endif - - " TERMINAL SETTINGS " Also enable fast terminal mode in GNU screen and tmux, but not for SSH @@ -942,6 +946,16 @@ if has('eval') " Only highlight the current placeholder. let g:xptemplate_highlight = 'current' +" Fzf settings + + " Use FZF if available + if executable('fzf') + nmap :FZF + + " Disable CtrlP + let g:ctrlp_map = '' + endif + " CtrlP settings. " Don't manage the working directory (the default setting is too slow for " me). @@ -1068,23 +1082,21 @@ if has('autocmd') autocmd FileType vimperator setlocal commentstring=\"%s " Use TeX compiler for (La)TeX files. autocmd FileType tex compiler tex +" Go always uses tabs for indentation. + autocmd FileType go call UseTabs() " FTDETECT AUTO COMMANDS -" Recognize .md as markdown files (Vim default is .mkd). - autocmd BufRead,BufNewFile *.md set filetype=mkd " Recognize .test as Tcl files. autocmd BufRead,BufNewFile *.test set filetype=tcl +" /etc/network/interfaces + autocmd BufRead,BufNewFile /etc/network/interfaces set filetype=interfaces " OTHER AUTO COMMANDS " Disable spell checking, displaying of list characters and long lines when " viewing documentation. autocmd BufReadPost /usr/share/doc/* setlocal nospell nolist | 2match - -" Use diff filetype for mercurial patches in patch queue. - autocmd BufReadPost */.hg/patches/* set filetype=diff - augroup END endif