Skip to content

Commit

Permalink
Favor execute() over :redir to minimize side effects
Browse files Browse the repository at this point in the history
If this is still unacceptable for users of ancient versions of Vim, we
could further change the else clause to `return 1`.

Resolves: #182
  • Loading branch information
tpope committed Jan 3, 2023
1 parent eb59f45 commit 8e274c2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugin/sensible.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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' a:option . '?'
redir END
if exists('*execute')
let out = execute('verbose setglobal ' . a:option . '?')
else
redir => out
silent verbose execute 'setglobal' a:option . '?'
redir END
endif
return out !~# ' \~[\/]'
endfunction

Expand Down

0 comments on commit 8e274c2

Please sign in to comment.