Monday, May 1, 2023

Re: Small documentation tweak for :g delimiters

Tim Chase wrote:

> Shortly after the help for :v it reads
>
> Instead of the '/' which surrounds the {pattern}, you can use any
> other single byte character, but not an alphabetic character,
> '\', '"' or '|'. This is useful if you want to include a '/' in
> the search pattern or replacement string.
>
> This makes it sounds like "!" should be a viable delimiter (as it
> it is for a :s command per `:help pattern-delimiter`). However,
> it ends up turning a :g command into a :v command.
>
> So in addition to excluding backslash, double-quote, and bar, I'd
> recommend adding "!" to the list here.
>
> -tim
>
> discovered by unthinkingly doing a
>
> :g!/path/
>
> and getting all lines that didn't contain "path" rather than all
> lines that did contain "/path/". Using an alternate delimiter like
>
> :g@/path/
>
> worked as expected. And I often use "!" as my pattern-delimiter
> in substitute commands when the pattern contains "/" characters

Thanks for the suggestion. I first thought this was only for ":global",
but using it with ":vglobal" gives an error "E477: No ! allowed".
Thus it can indeed be added to the list.

--
Scientists decoded the first message from an alien civilization:
SIMPLY SEND 6 TIMES 10 TO THE 50 ATOMS OF HYDROGEN TO THE STAR
SYSTEM AT THE TOP OF THE LIST, CROSS OFF THAT STAR SYSTEM, THEN PUT
YOUR STAR SYSTEM AT THE BOTTOM OF THE LIST AND SEND IT TO 100 OTHER
STAR SYSTEMS. WITHIN ONE TENTH GALACTIC ROTATION YOU WILL RECEIVE
ENOUGH HYDROGREN TO POWER YOUR CIVILIZATION UNTIL ENTROPY REACHES ITS
MAXIMUM! IT REALLY WORKS!

/// 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/20230501213725.049491C0916%40moolenaar.net.

No comments: