controlling vim via script or shell

6 views
Skip to first unread message

alex

unread,
Dec 5, 2008, 2:25:33 PM12/5/08
to vim_use
Is there a way to control gvim via the unix shell (or with a script) ?

For example:
gvim file1 &

opens file1 in gvim in the background
gvim has for example the PID 1000

now i want to open another file (say file2) IN THE SAME GVIM
APPLICATION from the shell.
So I want be able to type something like
gvim -PID 1000 file2

to open file2 in the same gvim application (in another buffer than
file1 of course, so that file1 and2 are opened at the same time)

Is this possible ?

Cory Echols

unread,
Dec 5, 2008, 2:29:49 PM12/5/08
to vim...@googlegroups.com
You can do it with gvim under X11 and MS Windows. See ":he remote.txt"

Tony Mechelynck

unread,
Dec 5, 2008, 3:00:40 PM12/5/08
to vim...@googlegroups.com
On 05/12/08 20:29, Cory Echols wrote:
> On Fri, Dec 5, 2008 at 2:25 PM, alex
> <alessandro.be...@gmail.com> wrote:
>> Is there a way to control gvim via the unix shell (or with a script) ?
>>
>> For example:
>> gvim file1&
>>
>> opens file1 in gvim in the background
>> gvim has for example the PID 1000
>>
>> now i want to open another file (say file2) IN THE SAME GVIM
>> APPLICATION from the shell.
>> So I want be able to type something like
>> gvim -PID 1000 file2
>>
>> to open file2 in the same gvim application (in another buffer than
>> file1 of course, so that file1 and2 are opened at the same time)
>>
>> Is this possible ?
>
> You can do it with gvim under X11 and MS Windows. See ":he remote.txt"

According to that same help file, you can even do it with Console Vim
under X11 and MS-Windows; but under X11 you need an explicit
--servername argument in both the client and the server if using Console
Vim.

In all cases, both the client and the server must be compiled with the
+clientserver feature.


Best regards,
Tony.
--
"He did decide, though, that with more time and a great deal of mental
effort, he could probably turn the activity into an acceptable
perversion."
-- Mick Farren, "When Gravity Fails"

alex

unread,
Dec 6, 2008, 9:26:21 AM12/6/08
to vim_use
Thank you !
Reply all
Reply to author
Forward
0 new messages