Wednesday, September 7, 2022

Re: Gvim message on XDG textedit URL link

> On Mi, 07 Sep 2022, Andrew Bernard wrote:
>
> > Sorry, this is all too hard it would seem. To explain in it in detail you
> > would have to read how to use point and click with PDFs made by Lilypond.
> >
> > The program gvim is producing unwanted messages when invoked with a remote
> > call and produces a needless pres ENTER, when all one wants is for the
> > remote call to go to the line and column.
> >
> > If there is any interest still, here is an example call:
> >
> > gvim --remote "+3:norm4" test.ly
> >
> > Apologies if I left this out. I thought people would be familiar with
> > textedit URLs and how to use them. I suppose that sort of call is not
> > obvious after all.
>
> Ah, so this comes from the --remote call.

That was the missing info. This leads to the remote server feature,
which builds a sequence of commands and sends it to the server.

For me it already helps to set 'cmdheight' to 2 or more.

> Interesting, that the :norm4 works, because there is no pipe after it.
> But it looks like Vim builds up the whole string dynamically and adds an
> '|' at the end automatically.
>
> However, I think this silently breaks, because the ":norm" sees
> everything after it as belonging to it, so in this case the '|' does not
> really end the user specified command and therefore you see this
> message. I messed around briefly, trying to wrap everything into an :exe
> expression (or using :call cursor), but at least, this did not seem to
> work on my windows environment.
>
> A possible work-around would be to it build the whole command yourself
> by using, e.g. --remote-send "<c-\><c-N>:e +3|norm4| .bashrc<cr>"
>
> or:
>
> --remote-send "<c-\><c-n>:e .bashrc<cr>|:e|norm4|<cr>"
>
> I wonder if this would work better with the following patch, by wrapping everything into an :exe call.
>
> diff --git a/src/clientserver.c b/src/clientserver.c
> index bb2108d7d..c4489c953 100644
> --- a/src/clientserver.c
> +++ b/src/clientserver.c
> @@ -654,8 +654,9 @@ build_drop_cmd(
> // Can't use <CR> after "inicmd", because a "startinsert" would cause
> // the following commands to be inserted as text. Use a "|",
> // hopefully "inicmd" does allow this...
> + ga_concat(&ga, (char_u *)":exe \"");
> ga_concat(&ga, inicmd);
> - ga_concat(&ga, (char_u *)"|");
> + ga_concat(&ga, (char_u *)"\"|");
> }
> // Bring the window to the foreground, goto Insert mode when 'im' set and
> // clear command line.

The main problem is that on the server this is received as a command and
put in the input buffer, after which it is executed almost as typed.

Instead of building the command on the client, which can end up being a
bit long, we could send the minimal information to the server and
expand it into the right commands there. We already have
runtime/plugin/rrhelper.vim.

--
Shift happens.
-- Doppler

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220907120332.616D71C0CE4%40moolenaar.net.

No comments: