I'm using Vim as a (debugger) frontend, but am bothered by the "flickering" screens when sending multiple commands at once. My current setup already uses lazyredraw that should work for functions. I communicate with a vim session using:

> vim --server "<servername>" --remote-send "<command>"

I basically send a unique function every time and then execute it, such that I can take advantage of lazyredraw. A typical <command> looks like:

:silent execute "function! Mycommands()\n \
vim test/src/main.cc\n                    \
execute "sign place 5 line=5 name=<SOMESIGN> file=" . expand("%:p")\n \
call cursor(5,1)\n                        \
redraw!\n                                 \
endfunction" |                            \
call Mycommands()<Enter>

It (1) opens a file, (2) highlights line 5 using a vim sign, and (3) moves the cursor to line 5.

If I record my vim session and slow it down, I see how this <command> is printed to the vim command line (It actually increase the cmd area for these long <command>'s), I then see how the file is opened, and lastly how the sign is placed. My questions are:

1) can I stop redrawing, send my commands, and then redraw?
2) can I disable the echoing of <command> to the vim commandline, like possible with a mapping using <silent>?
3) Is there a better way to achieve the frontend setup that avoids this issue?


1 Answer 1


one workaround is to write an tempfile with the command(s) in them. Then send a command to source this file. like in

> vim --server "<servername>" --remote-send "so /path/to/tempfile"
  • This approach works if I change the command to ":so[urce] /path/to/tempfile<Enter>" and remove the redraw!. Although I do now see the command in the vim commandline al the time.. I fixed this in an ungly way by adding i<Esc> at the end. Is there a better way to achieve this?
    – gospes
    May 18, 2017 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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