M
M
Maxim2013-06-21 20:27:11
Java
Maxim, 2013-06-21 20:27:11

Run vim from application like in git?

There is a need to run vim from your console java application (or any other test editor, both console and not, depending on the user's choice), for example, as in git when committing. Those. the user calls the application (by typing commands in the command line), it creates some files on the disk, and then I would like vim to automatically open and be able to edit these files.
Because if you call from getRuntime'a, then the editor will start in the background.
There is an option on the stack :

Process pr = Runtime.getRuntime().exec("gnome-terminal -e 'vim /tmp/tmpfile'");

But it opens a new terminal, which is not very convenient, and the terminals can be completely different.
Of course, you can call vim from the starting bash script after the program is executed, but there can be several files and they are determined during the program execution.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lolshto, 2013-06-21
@mgramin

If the program already has a console, then you can run not a terminal, but a shell:

sh -c 'vim /tmp/tmpfile'

J
jagoterr, 2013-06-26
@jagoterr

gvim --nofork

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question