On 09/12/2012 01:46 PM, Tony Mechelynck wrote:
On 12/09/12 01:54, Timothy Madden wrote:
On 09/11/2012 05:37 PM, Tony Mechelynck wrote:
[...]
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.

I tried with vim instead of gvim and with the -esS build.vim arguments.
While it is true I no longer get the window, now vim exits with the
return code 2 and I get no vimball built.

I suspect vim no longer loads plugins with the above switches, so my
     %MkVimball vcscommand-repack
command no longer works.ā

Thank you,
Timothy Madden


Yes, in batch mode (with -es) no scripts are sourced. To source them
anyway, add on top of your build.vim

     if filereadable("$HOME/.vimrc")
         source ~/.vimrc
     elseif filereadable("$HOME/_vimrc")
         source ~/_vimrc
     endif
     runtime! plugin/*.vim

Contrary to any and all of my expectations, it actually worked ... !
And I had already given up hope on this.

However the
        :runtime! plugin/*.vim
command by itself did not help me. It turns out that -s has another side effect: without the .vimrc file being read, Vim never needs to reset 'compatible' (which normally happens automatically at the first .vimrc line executed)

With 'compatible' on, my plugin (vimballPlugin.vim) would still not load. If I use -N on the command line, as Gary Johnson already indicated in the answer here, the plugin gets loaded normally, and I do not even need the :runtime command anymore.

So in the end the solution was to use this command line:
        vim -NesS build.vim

Now the -s switch to does a good job to hide the window, but at the same time it hides all script output, even the errors, which is not so good, so one other thing I had to do in addition to the above command line was to set verbose to non-zero. Which can also be done from the command line, but unfortunately it no longer fits in a shebang command line (it already has one other option argument, -S).

Thank you,
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

Reply via email to