I have found how to silently execute a command with :silent, but I actually would like to echo the command being executed, without getting into this "hit-enter" prompt. How to do it?

My example is a function for synctex forward search, put into my vimrc:

function! SyncTexForward()
    " use file path relative to current directory
    let execstr = "silent !zathura --synctex-forward ".line(".").":".col(".").":".@%." ".fnamemodify(@%, ":r") . ".pdf &"
    exec execstr

Without silent, it would display the command + its output, that is one line with the pid, like this:

:!zathura --synctex-forward 612:1:myfile.tex myfile.pdf &
[1] 4648

Press ENTER or type command to continue

I tried temporarily changing &cmdheight to 2, but it has the same effect as silent (no echo at all)

1 Answer 1


So my question was quite stupid actually. It sufficed to add:

echo execstr

just before

exec execstr

Now if I could also capture the shell stdout and display it too, it would also be nice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.