On 2009-11-20, epanda wrote:
> This is my command :
>
> vim -c "source C:\scripts\script.vim" -c "argdo call Func()<CR>"  -c
> "exec 'saveas! '.expand('%%:p:h') . '\new_' . expand('%%:t')" -c
> "qall!" exportSql.xml
>
>
> The Func called is doing its job but I have to put ENTER KEY to make
> vim exit.

Here's what I did.  I created a new directory under my home
directory,

    C:\Documents and Settings\garyjohn\t2

In that directory I created two files, script.vim and exportSql.xml.
The latter is empty.  The script.vim contains this:

    function Func()
        " Do nothing
    endfunction

Then, in a DOS window cd'd to that directory, I executed your
command but with a different path to script.vim:

    vim -c "source script.vim" -c "argdo call Func()<CR>" -c "exec 'saveas! 
'.expand('%%:p:h') . '\new_' . expand('%%:t')" -c "qall!" exportSql.xml

The result was that the screen was cleared and these lines were left
at the bottom:

    "exportSql.xml" 0L, 0C
    Error detected while processing command line:
    "exportSql.xml\new_exportSql.xml"
    "exportSql.xml\new_exportSql.xml" E212: Can't open file for writing
    C:\Documents and Settings\garyjohn\t2>

I replaced each %% pair with a single % and tried again.  This time
the file name was expanded correctly, but I got error E488.  That
turned out to be from the unnecessary "<CR>" following the call to
Func().  After fixing those problems, I was left with this command:

    vim -c "source script.vim" -c "argdo call Func()" -c "exec 'saveas! 
'.expand('%:p:h') . '\new_' . expand('%:t')" -c "qall!" exportSql.xml

which, when executed, left these lines at the bottom of the screen.

    "~\t2\new_exportSql.xml" 0L, 0C written
    C:\Documents and Settings\garyjohn\t2>

Note that vim has exited.  No "ENTER KEY" message.  So I'm still not
seeing the problem.

I remembered some discussion of a batch file and needing the %% to
avoid a problem with cmd.exe treating the single %s specially, so I
copied that last command into a file names t2.bat, replaced each
single % with a %% pair, saved the file and executed it.  Vim still
exited as it should.

> I don't understand "trim the material"

What I meant was expressed more clearly by John Beckett in response
to another of your posts:

    Please bottom post on this list. Quote a small (relevant) part
    of the message you are replying to, and put your text underneath.

    See the list guidelines:
    http://groups.google.com/group/vim_use/web/vim-information

Regards,
Gary



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to