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.

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.


Thanks,
Christian
--
10E12 Mikrophone = 1 Megaphon
10E-6 Fisch = 1 Mikrofiche
10E21 Picolos = 1 Gigolo
10 Rationen = 1 Dekoration
3 1/3 Tridents = 1 Dekadent
10 Monologe = 5 Dialoge
2 Monogramme = 1 Diagramm

--
--
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/20220907084704.GD1359453%40256bit.org.

No comments: