dalance / amber

A code search / replace tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use \n in replacement string?

Boscop opened this issue · comments

When I use \n in the replacement string, it doesn't work:

$ ambr -r "(?m)Vec3A as Vec3,\n" "Vec3,\n"
./spheres/src/lib.rs:   pub resolution: Vec3A as Vec3,
        pub time: f32,
                   ->   pub resolution: Vec3,\n pub time: f32,
Replace keyword? [Y]es/[n]o/[a]ll/[q]uit: q

I've added escaped charactor support in keyword and replacement like below:

$ ambr "Vec3A as Vec3,\n" "Vec3,\n"

it's not clear to me how to prevent expansion of escape sequences in the replacement

e.g. to print \n (backslash n) instead of replacing it with a newline