Friday, May 25, 2012

Re: Substitution of metacharacters

On Thu, May 24, 2012 at 10:53:27AM EDT, Tim Chase wrote:
> On 05/24/12 08:34, Bob von Knobloch wrote:

> > Hi, I've searched all over but can't find an answer. How can one
> > perform commands like ':%s/\n/\r\r/g' (replacing newlines or tabs
> > etc.) in the gui's 'find and replace' dialogue?

> Playing around with :promptrepl (the underlying command), it looks
> like the *search* portion of it is happy to take various regexps.
> However the replacement part only seems to accept literals. Thus in
> your example, it puts in a literal "\r\r" instead of two newlines.

Search/replace behavior in the GUI is not only different than in the
console version but appears to lead to inconsistencies: try a search
'.*' for instance and compare with '\s\s'.

> So I guess my short answer based on testing is: when using the gui
> find-and-replace, there's no way to replace with anything but literals.
>
> I'd be glad if someone could prove me wrong (it seems a peculiar
> development choice to lose the parity with :substitute)

+1 .. (fwiw, since I don't use the GUI).

Would that be worth a feature/enhancement request?

In the ELinks text-mode browser, e.g. the popup dialog has the following
checkboxes:

( ) Normal search ( ) Regexp search (X) Extended regexp search

There are probably other examples of this feature that are more relevant
to the GUI world but perhaps Vim could have a 'Regex' checkbox: checking
it would activate regex mode both for search & replace..?

CJ

--
WHAT YOU SAY??

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

No comments:

Post a Comment