Skip to content

Commit 72292cb

Browse files
committed
vitalizer: Avoid the bug of execute()
1 parent 982e0bf commit 72292cb

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

autoload/vital/vital.vim

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -257,20 +257,20 @@ function! s:_sid(path, filter_pattern) abort
257257
return 0
258258
endfunction
259259

260-
" A bug of execute() is fixed in Vim 8.0.0264
261-
if has('patch-8.0.0264')
262-
let s:_execute = function('execute')
263-
else
264-
function! s:_execute(cmd) abort
265-
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
266-
set verbose=0 verbosefile=
267-
redir => res
268-
silent! execute a:cmd
269-
redir END
270-
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile]
271-
return res
272-
endfunction
273-
endif
260+
" We want to use a execute() builtin function instead of s:_execute(),
261+
" however there is a bug in execute().
262+
" execute() returns empty string when it is called in
263+
" completion function of user defined ex command.
264+
" https://github.com/vim-jp/issues/issues/1129
265+
function! s:_execute(cmd) abort
266+
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
267+
set verbose=0 verbosefile=
268+
redir => res
269+
silent! execute a:cmd
270+
redir END
271+
let [&verbose, &verbosefile] = [save_verbose, save_verbosefile]
272+
return res
273+
endfunction
274274

275275
if filereadable(expand('<sfile>:r') . '.VIM') " is case-insensitive or not
276276
let s:_unify_path_cache = {}

0 commit comments

Comments
 (0)