If Vim command-line is being edited and the Vim instance receives a string due to vim --remote-send KEYS
executed on a shell somewhere, result is somewhat equivalent to pressing Return
in the command-line and typing the received KEYS
afterwards. Since the command that is unintentially executed can be hard to recover (an artificial example could be !rm -rf *
), is there a way to prevent this behavior?
Initial idea was to send e.g. <Esc><Esc>KEYS
to discard any possible active input in the receiving Vim instance. This does quit a potentially active Insert mode and prevents KEYS
landing in the current buffer. But this is does not work for the command-line input.
I was thinking of some autocommand-event to trigger user confirmation upon remote keys receipt, but none of available events looked right for the case.