Skip to content

Commit

Permalink
lift up execute() check into s:Execute()
Browse files Browse the repository at this point in the history
  • Loading branch information
mralusw committed Mar 20, 2024
1 parent 3e878ab commit 71538f6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions plugin/sensible.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ if &compatible
set nocompatible
endif

if exists('*execute')
let s:Execute = function('execute')
else
function! s:Execute(cmd) abort
redir => out
silent verbose execute a:cmd
redir END
return out
endfunction
endif

" Check if an option was set from a file in $HOME. This lets us avoid
" overriding options in the user's vimrc, but still override options in the
" system vimrc.
function! s:MaySet(option) abort
if exists('*execute')
let out = execute('verbose setglobal all ' . a:option . '?')
else
redir => out
silent verbose execute 'setglobal all' a:option . '?'
redir END
endif
let out = s:Execute('verbose setglobal all ' . a:option . '?')
return out !~# " \\(\\~[\\/][^\n]*\\|Lua\\)$"
endfunction

Expand Down

0 comments on commit 71538f6

Please sign in to comment.