I'm playing a game that has a scripting language. It has a button to open the scripts in external editor. You can set the command that will trigger the editor from within the game's interface.

/usr/bin/X11/gvim opens the scripts in gvim

now what I would like to know is, if it's doable, to open the scripts in terminal's vim and if instead of opening a new one each time to add tabs to the existing instance. What would be a command to do that?

the way of adding tabs is :tabe filename or from terminal for multiple documents

vim -p file1, file2

I guess there are more that I don't know, I hope this is doable.


1 Answer 1


Yes, this is possible with vim's server mode. Start a vim-server with:

vim --servername somename

Now you can send commands to it with --remote, --remote-send and others.

To achieve what you want, start a server with a known name, send the :tabe commands with:

vim --servername somename --remote-send ':tabe filename<cr>'

Note the same commands work for gvim. If this should work from within another program, you need to start the vim-server prior to any --remote-send commands. The edit command within the program should then be: vim --servername somename --remote-send ':tabe %s<cr>', assuming %s is replaced by the filename to edit.

  • Ty for your answer, I def learned something from that. But it doesn't seem to work. The problem is that I don't actually know how that external editor command works. E.g why wouldn't open vim in terminal? Even a single instance, it just wont do it. But it will open gvim. This is not kewl. Plus I don't know if it can accept command line arguments. This really bothers me, multiple windows are never good.
    – Not Amused
    Dec 4, 2012 at 20:23
  • @DeusDeceit: IIUYC, you should first start the vim-server outside the program that will call vim --remote-send. See the added note above.
    – Thor
    Dec 5, 2012 at 8:38

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.