I’m using (mac)vim with tex-suite and would like to have a single regex command (or any other way) to do the following thing:
Change
\textcolor{green}{some random text}
into
some random text
This should be done for all occurrences of \textcolor{green}{} in my tex file…
Any idea?
EDIT: I need it to recognize matching braces. Here an example :
\textcolor{green}{
with $v_\text{F}\sim10^6$m.s$^{-1}$ the massless Dirac fermions
velocity in pristine graphene}.
In my experience, things like this most often crop up during editing, and you might have the search for
\textcolor{green}{already highlighted.In such a scenario,
:globalis usually my weapon of choice:diBvaBp: diB (delete inner block), vaB (select block), p (put)
If you have surround.vim installed (recommend it!) you could remove the pair of braces simply doing
dsB(delete surrounding {})Of course, you can combine it like
I just noted a potential issue when the target patterns don’t start at the beginning of a line. The simplest way to get around that is
A more involved way (possibly less efficient) would be using a macro:
Followed by something like
100@qto repeat the macro