Tuesday, June 30, 2020

Re: An interesting little poser [PS]

On Mon, Jun 29, 2020 at 03:34:03PM EDT, Tim Chase wrote:

> Try changing that line from
>
> $?^$?+,$g/^\[\@!.*\n\[\@!/,/\n\[\|\%$/j
>
> to
>
> $?^$?+,$g/^\[\@!.*\n\[\@!./,/\n\[\|\%$/j

This indeed fixes the problem.

Still trying to wrap my head around this bizarre

:g/regex1/,/regex2/command ... syntax.

I eventually found something in the user manual that (sort of) explains
what's going on here... under [edit-paragraph-join].

What I understand is that somewhat in a 'shorthand manner'... with the
:g(lobal) command you can specify a second /patttern2/ (separated from
the 'normal' g /pattern1/ by a comma) defining a range for the command
executed by :global... or in other words that the command executed by
':g' will target not the current line (as is normally the case) but
rather all the lines in the range from 'current line' (the line :g is
currently point at) to the next line in the buffer that matches
/pattern2/...

Rather comical that I spent so much time wondering what that comma
somewhere in the middle of what I assumed was one single regex was
about...! never imagined this comma in '/pattern1/,/pattern2/' was not
part of a regex but rather the range separator... Incidentally this
clarifies vim's 'invalid range' message - i.e. it's the join command's
range he's complaining about... not the global :g range!

In any case the modified Unfootnote() function now does the job without
a glitch.

Thank you very much for your help!

CJ

--
--
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/20200630223309.GD4819%40turki.local.

No comments:

Post a Comment