mirror of
https://github.com/tpope/vim-sensible.git
synced 2025-11-09 19:43:48 -05:00
Favor execute() over :redir to minimize side effects
If this is still unacceptable for users of ancient versions of Vim, we could further change the else clause to `return 1`. Resolves: https://github.com/tpope/vim-sensible/issues/182
This commit is contained in:
@@ -21,9 +21,13 @@ endif
|
|||||||
" overriding options in the user's vimrc, but still override options in the
|
" overriding options in the user's vimrc, but still override options in the
|
||||||
" system vimrc.
|
" system vimrc.
|
||||||
function! s:MaySet(option) abort
|
function! s:MaySet(option) abort
|
||||||
|
if exists('*execute')
|
||||||
|
let out = execute('verbose setglobal ' . a:option . '?')
|
||||||
|
else
|
||||||
redir => out
|
redir => out
|
||||||
silent verbose execute 'setglobal' a:option . '?'
|
silent verbose execute 'setglobal' a:option . '?'
|
||||||
redir END
|
redir END
|
||||||
|
endif
|
||||||
return out !~# ' \~[\/]'
|
return out !~# ' \~[\/]'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user