Reputation: 113
I am trying to figure out how to script vim to send a message to a gnu screen "window". i.e. I have a screen session open and in one window I have a vim session and in the other a scheme interpreter. When I save my vim session I would like it to restart the interpreter in the other window loading in the new environment. I can figure out everything other than how to have an "on save" hook in vim send a shell command to another "screen window" causing the script to terminate and restart. if I could figure out how to send commands I could kill the process and then start a new one - I just need to make sure it starts in the right "window".
Upvotes: 2
Views: 1746
Reputation: 89123
Have vim issue shell commands, and use screen -X
to issue commands to screen. Some permutation of :at <other-window> stuff <restart-command>
. See man screen
's customization section for more commands.
For example, if I was in screen window 1, using vim, and I had an irb session in window 0, to restart the irb session, I would do
:!screen -X at 0 stuff exit^Mirb^M
(^M
entered via CTRL-V Enter).
Upvotes: 4
Reputation: 141
If it is sufficient for you to have the scheme interpreter run every so many seconds, you could just run watch /path/to/scheme/interpreter /path/to/scheme/file
in the second screen window. Adjusting the time intervals in which watch
runs commands can be adjusted using command line parameters. The watch
man page contains the details.
Upvotes: 1