Tuesday, September 11, 2012

Re: How to execute script from cmdline without Vim window

On 09/11/2012 10:14 AM, Gary Johnson wrote:
> On 2012-09-11, Timothy Madden wrote:
>> Hello
>>
>> I would like to execute a Vim script from the command line, for
>> example to build a vimball archive from a Makefile.
>>
>> But when I do that the Vim window always pops up and then immediately
>> disappears (as the script completes). Even if there are errors in the
>> window.
>>
>> Is there a way to execute the vim script without a Vim window ? And
>> to get the errors on stdout ?
>
> Sure. Use the -E option along with a -c option for each ex command
> you want to execute.
>
> vim -E -c 'some ex command' -c 'another ex command' -c q
>
> See
>
> :help -E
> :help -s
>
> There are more examples here:
>
> :help $VIMRUNTIME
> :help g:html_no_progress
> :help 26.4

I read about the switches, they do not seem to work.
gvim -E -c 'source build.vim'
still opens and closes the damn window.

If I add the colons ':' to build.vim and I try
gvim -E -s < build.vim
vim returns an error exit status and does not build the vimball.

So it is either I get a window that flashes (opens and closes), either I
get an error with no vimball.

Does Vim load system plugins when -s is used ?

My simple build.vim script is as follows:

:echo 'Starting vimball script'
:new
:normal iplugin/vcsbzr.vim
:normal oplugin/vcscommand.vim
:normal oplugin/vcssvn.vim
:%MkVimball! vcscommand-repack
:if v:errmsg == ''
: qall!
:else
: cquit
:endif


Regards,
Timothy Madden

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: