Skip to content

Commit a2f5709

Browse files
authored
Merge pull request #557 from vim-jp/fix-vitalizer-completion
vitalizer: Avoid the bug of execute()
2 parents 982e0bf + 72292cb commit a2f5709

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

autoload/vital/vital.vim

+14-14
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)