Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to do the following:

  1. Start a new screen session
  2. Start vim on it.
  3. Feed commands to it.
  4. Check the output

as a means of testing vim. I can do this, but the catch is that I want it to be opaque to the user.

In other words, the user runs my test script, and without showing them the script creates a new screen, runs vim on it, and away we go with the testing.

Is this possible? Can I run vim in a detached screen and have it operate as expected?

(Note: I'm not attached to screen, tmux or some other multiplexor or really any method of piping controlled input to an invisible vim instantiation would be fine.)

I've done this manually (split my terminal and run the -X stuff commands in one screen with vim in the other) but any time I try to write a script to do it it doesn't work. I'm having a lot of trouble figuring out why it doesn't work, because I can't exactly attach to the screen and watch...

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I don't really understand what you want to do as you explain the means you have imagined instead of your goal.

If it is compiled with the right options, you can launch vim in "clientserver mode" with this command:

$ vim --servername HIDDEN

and send commands with:

$ vim --servername HIDDEN --remote-send 'ihello<CR>'

or edit a file with:

$ vim --servername HIDDEN --remote filename

See :h clientserver.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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