I'm currently stuck on this problem. I want, in a vimscript, to replace a variable's brackets when they contain a certain pattern.
To say this differently, say I have a variable
foo = "[content] bar" .
My purpose is to replace [content] with an empty string, which means that after the substitution we'll get:
foo = " bar".
The current solution I could find is:
let foo = substitute(foo, "\[\]", "") | let foo = substitute(foo, "content", "")
but couldn't manage to get it in one call.
Is there something I'm missing? Could this be done more easily?