On 2013–01–10 Christian Brabandt wrote:

> > If I run /\\bar in normal mode this works. What is wrong with this
> > and how do I rewrite the search so that \bar is found including the
> > backslash?
> 
> You are searching for "\b"ar, where \b translates to the backspace char. 
> This is described at :h expr-string.

This only explains the need to escape a backslash with a backslash,
not the need for double-escaping. And I didn't find the information
either in :h normal or :h execute. I assume the reason is that the
string is parsed twice and escaping needs to be done once for each
step.

> You want either to use :exe 'norm! /\\bar'."\n" or
> :exe "norm! /\\\\bar\n"
               ^^^^

That's what I call extreme escaping ;)

Thanks Christian and Andy, your solutions work fine.

Marco

Attachment: signature.asc
Description: Digital signature

Reply via email to