Escaping stuffs is the painful bread and butter of writing Kakoune plugins mixing different languages (bash, sed, awk…)
Here’s a nice article attempting to describe the beast and offer some potential solutions: https://axelsvensson.com/escaping-escaping
some times I miss something like raw strings from Rust in such environments like shell. But I think that Kakoune handles nested strings perfectly
I like how raw strings are handled in Lua. Basic form is
[[foo]]. If you need
]] inside raw string you can throw any amount of
= between brackets:
a = [===[ this is fine -> ]==] ]===] --> " this is fine -> ]==] "