Launch vimscript from Win system

24 views
Skip to first unread message

niva

unread,
Nov 6, 2012, 10:32:26 AM11/6/12
to vim...@googlegroups.com
Hi,


I have done some functions into a vimscript.

I would like to launch those vimscript functions by external system call.(system win32).

Thank you

Marc Weber

unread,
Nov 6, 2012, 10:44:19 AM11/6/12
to vim_use
Excerpts from niva's message of Tue Nov 06 16:32:26 +0100 2012:
> I would like to launch those vimscript functions by external system call.(system win32).
What do you mean by "external sytsem call."?

The only way to communicate with vim from the outsied is by using
client-srever or the netbeans api.

You can't call viml code from the outside (like using a dll) - all you
can do is "write input to a file", "call vim whih writes output to a
second file", "read result" like things, and little nicer by using the
client-server features. :h client-server :h netbeans

I'd consider rewriting your code in another language such as python
- depending on how much it is. You can run python from within vim, but
also outside of Vim

Marc Weber

Charles E Campbell Jr

unread,
Nov 6, 2012, 9:32:17 PM11/6/12
to vim...@googlegroups.com
I think I'm going to disagree here -- perhaps vim's -c option will
help. See :help -c .

As an example, consider

vim -c "echo 'hello'" -c "sleep 3" -c q

which will run vim, show "hello" in the messages, wait 3 seconds, and
then quit. So, you presumably could

vim -c "call MyFunction()" -c q

and vim will run your function.

Now, I agree with Marc that I don't really know what you mean by running
vim via an "external system call". How do you intend to launch vim? If
by an icon, you presumably could set its "properties" so as to run vim
with the -c arguments as I showed. If you're using cygwin or the
dos-shell, again, you could run vim as shown (you may need to specify
the full path).

I also agree with Marc that you can't really interact with vim via an
external interface other than via the client-server or netbeans
mechanisms (well, mostly not; I've managed to put together something
that lets gdb talk to vim under linux/unix systems).

Regards,
Chip Campbell



niva

unread,
Nov 7, 2012, 2:31:35 AM11/7/12
to vim...@googlegroups.com
Le mercredi 7 novembre 2012 03:32:28 UTC+1, DrChip a écrit :
> Marc Weber wrote: > Excerpts from niva's message of Tue Nov 06 16:32:26 +0100 2012: >> I would like to launch those vimscript functions by external system call.(system win32). > What do you mean by "external sytsem call."? > > The only way to communicate with vim from the outsied is by using > client-srever or the netbeans api. > > You can't call viml code from the outside (like using a dll) - all you > can do is "write input to a file", "call vim whih writes output to a > second file", "read result" like things, and little nicer by using the > client-server features. :h client-server :h netbeans > > I'd consider rewriting your code in another language such as python > - depending on how much it is. You can run python from within vim, but > also outside of Vim > I think I'm going to disagree here -- perhaps vim's -c option will help. See :help -c . As an example, consider vim -c "echo 'hello'" -c "sleep 3" -c q which will run vim, show "hello" in the messages, wait 3 seconds, and then quit. So, you presumably could vim -c "call MyFunction()" -c q and vim will run your function. Now, I agree with Marc that I don't really know what you mean by running vim via an "external system call". How do you intend to launch vim? If by an icon, you presumably could set its "properties" so as to run vim with the -c arguments as I showed. If you're using cygwin or the dos-shell, again, you could run vim as shown (you may need to specify the full path). I also agree with Marc that you can't really interact with vim via an external interface other than via the client-server or netbeans mechanisms (well, mostly not; I've managed to put together something that lets gdb talk to vim under linux/unix systems). Regards, Chip Campbell

Yes that's the good answer.
Thank you
Reply all
Reply to author
Forward
0 new messages