1

In my understanding, the return value of execute(command) should be what command outputs. (The second parameter of execute is to affect whether this output will also be displayed in vim.)

Now command runs a function and inside the function there is silent! echo 3. so command itself does not have output. Shouldn't the result of execute be empty?

Ex:

function! s:x()
  silent! echo 3
endfunction
let x = execute('call s:x()') 
" let x = execute('call s:x()', '')  does not alter the output
" this means `call s:x()` itself has no output
echo 'x is' x

shows

x is
3

instead of

x is    

Is this a bug? How to explain the phenomenon in the comment?

doraemon
  • 1,667
  • 11
  • 27

0 Answers0