From 6d28b9fca6aa5aa16c35615ed48b0b61572ee975 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 3 Oct 2020 20:44:40 +1300 Subject: Refactor patch testing into new patch#() wrapper This is a little more efficient, and perhaps a bit clearer, too. --- vim/vimrc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc index fd7fa56b..178075ef 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Sat, 19 Sep 2020 08:36:41 UTC +" Last updated: Sat, 03 Oct 2020 07:24:40 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -72,7 +72,7 @@ " " " -if has#('multi_byte') +if has('multi_byte') if &encoding ==# 'latin1' && !exists('$LANG') set encoding=utf-8 endif @@ -238,7 +238,7 @@ if s:xdgcachehome !=# '' call mkdir(s:xdgcachehome.'/backup', 'p', 0700) endif execute 'set backupdir^='.option#Escape(option#item#Escape( - \ s:xdgcachehome.'/backup'.(has#('patch-8.1.251') ? '//' : '') + \ s:xdgcachehome.'/backup'.(patch#('8.1.251') ? '//' : '') \)) endif @@ -248,7 +248,7 @@ endif " default value of 'backupskip' here, in order to prevent the creation of such " undesired backup files. " -if has#('unix') +if has('unix') " Prior to v8.1.1519, Vim didn’t check patterns added to 'backupskip' for " uniqueness, so adding the same path repeatedly resulted in duplicate strings @@ -260,7 +260,7 @@ if has#('unix') " " " - if !has#('patch-8.1.1519') + if !patch#('8.1.1519') set backupskip& endif @@ -316,7 +316,7 @@ endif " Support for these persistent undo file caches was not released until v7.3.0, " so we need to check for the feature’s presence before we enable it. " -if s:xdgcachehome !=# '' && has#('persistent_undo') +if s:xdgcachehome !=# '' && has('persistent_undo') set undofile if !isdirectory(s:xdgcachehome.'/undo') call mkdir(s:xdgcachehome.'/undo', 'p', 0700) @@ -331,7 +331,7 @@ endif " directories of this type. This isn't a comma-separated list like the others " ('backupdir', 'directory', 'spell', 'undodir') " -if s:xdgcachehome !=# '' && has#('mksession') +if s:xdgcachehome !=# '' && has('mksession') if !isdirectory(s:xdgcachehome.'/view') call mkdir(s:xdgcachehome.'/view', 'p', 0700) endif @@ -526,7 +526,7 @@ set linebreak " Checking that ‘&encoding ==# 'utf-8'’ is not quite the same thing, though " it’s unlikely I’ll ever use a different Unicode encoding by choice. " -if has#('multi_byte_encoding') +if has('multi_byte_encoding') set showbreak=… else set showbreak=... @@ -610,7 +610,7 @@ set formatoptions+=1 " " " -if has#('patch-7.3.541') +if patch#('7.3.541') set formatoptions+=j endif @@ -650,7 +650,7 @@ set cpoptions+=J " " " -if has#('patch-8.1.728') +if patch#('8.1.728') set formatoptions+=p endif @@ -662,7 +662,7 @@ endif " flag should be set here, rather that in the GUI-specific gvimrc file, as one " might otherwise think. " -if has#('gui_running') +if has('gui_running') set guioptions+=M endif @@ -733,7 +733,7 @@ set listchars+=nbsp:+ " Non-breaking spaces " " Failing that, ‘<’ and ‘>’ will do the trick. " -if has#('multi_byte_encoding') +if has('multi_byte_encoding') set listchars+=extends:»,precedes:« else set listchars+=extends:>,precedes:< @@ -977,7 +977,7 @@ endif " it. " if &background ==# 'dark' - \ && (has#('gui_running') || &t_Co >= 256) + \ && (has('gui_running') || &t_Co >= 256) \ && globpath(&runtimepath, 'colors/sahara.vim') !=# '' colorscheme sahara endif -- cgit v1.2.3