-
Notifications
You must be signed in to change notification settings - Fork 407
search/replace in math environments only using in_mathzone or wrap_math? #1846
Description
Thanks again for this great plugin.
Is your feature request related to a problem? Please describe it.
Feature request. It is sometimes very handy to search+replace in math mode only. For instance, I now would like to boldface all vectors x in mathmode with \mathbf{x}. However :%s/x/\\mathbf{x}/g obviously matches all the x in the text outside of math environments.
Describe the solution you'd like
Possibility to search/replace, if possible using vim's built-in replacement, but only in the math (both inline, display equations, align environment etc).
As vimtex already has syntax#in_mathzone and wrap_math, I an wondering if it would be easy to re-use these wrappers and achieve replacement in math mode only without too much work.
Describe alternatives you've considered
I usually achieve this by using vim's built-in replacement, say :%s/A/\\mathbf{A}/gc and skipping by hand and skipping all instances not in math zone by hand. Maybe it's possible to use in_mathzone to skip automatically the matches that are not in math environments.