Suppose I want to change
\hl{abc}
\{}
{
}
\hl{12}
to
abc
\{}
}
{
12
i.e. I want to remove \hl{
and }
from around what's inside them. How can I do this in vim? I was considering :s/\\hl{.*}//g
but that also takes away the text in between.
CodePudding user response:
You can use \(…\)
(see :help /\(
) to capture the text in between, and use \1
(see :help s/\1
) to make use of it in the substitution: :s/\\hl{\(.*\)}/\1/g
.