Reputation: 1
I want to search for e.g.
\emph{word}
and replace it
with
word
So, I want to delete the surrounding \emph{}.
How can I do this using Vim?
Upvotes: 0
Views: 120
Reputation: 53654
If word
can contain nested subgroups (like in \emph{Do {\bf something} now}
which is valid) you will have to use (in normal mode)
qaqqa/\\emph<CR>dt{ds{@aq@a
This assumes that you have surround.vim installed.
Upvotes: 1
Reputation: 1411
Have a look here: Vim searches
You probably want something like :%s/\\emph{\([^}]+\)}/\1/g
Upvotes: 2