Favor execute() over :redir, for performance

Resolves: https://github.com/tpope/vim-sensible/issues/186
This commit is contained in:
Tim Pope
2023-02-23 07:31:11 -05:00
parent 16283468be
commit a7eea09ba6

View File

@@ -21,9 +21,13 @@ endif
" 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
return out !~# " \\~[\\/][^\n]*$"
endfunction