On 11/09/12 12:03, Timothy Madden wrote:
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
That build script consists only of ex-commands, so you can omit the
leading colons and run Vim in batch mode as follows:
vim -esS build.vim
see
:help -e
:help -s-ex
:help -S
If you want your vimrc to be used, you will need to explicitly add a -u
argument for it.
You don't need a GUI, so no need to use gvim. If you don't _have_ a
Console Vim (and are on Windows), well, I don't know if you can avoid
opening the GUI. But you can try replacing vim by gvim in the above command.
Best regards,
Tony.
--
"A power so great, it can only be used for Good or Evil!"
-- Firesign Theatre, "The Giant Rat of Summatra"
--
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