The Linux Page

Sending commands to gvim from your console

Pigeon deliverying a message

It is possible to send a command to a running gvim instance.

Here is an example on how to send a Write + Quit:

vim --servername GVIM --remote-send '<C-\><C-N>:wq<CR>'

As we can see, the syntax for the command is very similar to what we usually have in our macros.

The name "GVIM" is what you need to use (i.e. it's not the name of the server on which the gvim editor is running (a.k.a. NOT localhost).

I have not yet tested if I have multiple windows, would the instructions be sent to all or just one. I suppose I should look at the documentation too...