From a7eea09ba654a371a90ca77186bf10930b897e80 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 23 Feb 2023 07:31:11 -0500 Subject: [PATCH] Favor execute() over :redir, for performance Resolves: https://github.com/tpope/vim-sensible/issues/186 --- plugin/sensible.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/sensible.vim b/plugin/sensible.vim index 42a9c1b..64255d5 100644 --- a/plugin/sensible.vim +++ b/plugin/sensible.vim @@ -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 - redir => out - silent verbose execute 'setglobal all' a:option . '?' - redir END + 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