From: Simon Ruderich Date: Sun, 17 Jun 2018 06:19:41 +0000 (+0200) Subject: vim/vimrc: move helper functions to the top X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=ff40bda110142568d1ad67928882a23bf1ce0a80;p=config%2Fdotfiles.git vim/vimrc: move helper functions to the top --- diff --git a/vim/vimrc b/vim/vimrc index bb55535..8476842 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 @@ -127,29 +150,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