I editing a latex file into html and I want to change all \\ with a <br /> -tag.
:%s@\\@<br />@g
Vim uses the first character after the :%s as delimiter so that not a problem.
But I keep getting all the single \ in my search just as as \\. I’m guessing that the first \ is mapped to something but I don’t no what or how to fix it.
And if I instead search do
:%s@\\\@<br />@g
I get E59 : invalid character after \@ and E476 Invalid command.
Are you trying to replace all occurrences of two backslashes with
<br />? If so, you need to escape both backslashes:A backslash is interpreted as an escape character that pairs up with the next character to indicate something special. For example,
\tis used to indicate a tab character. To specify a backslash itself, you need two backslashes, so if you want two backslashes consecutively, you need to enter four.