ex-mode icon indicating copy to clipboard operation
ex-mode copied to clipboard

Replacing \n

Open jazzpi opened this issue 10 years ago • 2 comments

In vim, you can replace \n with a newline by running :s/\\n/\r.

In ex-mode, you have to use :s/\\\\n/\n.

I'm not sure whether we should follow vim in the replacement patterns (\n = NUL, \r = NL), but using \\\\n to match \n isn't right.

jazzpi avatar Mar 11 '16 17:03 jazzpi

+1

I just encountered that bug when trying to replace a LaTeX-command. I had to search for \\\\mycommand instead of \\mycommand.

Turysaz avatar Jan 10 '17 12:01 Turysaz

It might be that this is because the substitute-function calls the replace-routine for all matches (line 352 in ex.coffee ), but replace/replaceGroups checks for the regex-match, too, so the expression is double-checked. But I've never written any coffee-script and it is more a guess than the result of a professional code review, so I might be wrong about it...

Turysaz avatar Jan 10 '17 12:01 Turysaz