Friday, November 3, 2017

Re: Silent invocation of gvim on Windows

On Wednesday, November 1, 2017 at 6:45:39 PM UTC-5, Joseph L. Casale wrote:
> I have a use case where the optimal tool for my need is gvim as I don't have access to anything more suitable in the context. I am trying to invoke gvim as a process to perform a replacement (no shell or batch based invocation).
>
> The arguments I am passing (which are simply string joined with a space) are:
>
> string[] arguments =
> {
> "-N",
> "-u",
> "NONE",
> "-i",
> "NONE",
> "-n",
> "-es",
> "-c",
> "\"%s/.*foo.*/bar/g | w\"",
> @"x:\path\to\file"
> };
>
> The replacement is performed as expected, however the return code is 1. Is that by design, or as a result of something I have done incorrectly? The facility performing the invocation checks for a non zero return code and it would be desirable for that to be the case when a genuine error has occurred.
>
> Thanks

Why gvim and not console vim? I don't know if it is the cause, but if you must use gvim then on Linux and similar systems you need to also pass the "-f" argument if you want your code to wait for gvim to be exited. This doesn't work in Windows, but the official installer can create a .bat file with an implementation of a similar feature.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment