Loading ...
Sorry, an error occurred while loading the content.
 

Re: how to apply an ex command to text matching a pattern?

Expand Messages
  • Charles E. Campbell, Jr.
    ... Hello! David Fishburn came up with SrchRplcHiGrp.vim, which allows one to do substitutes based on highlighting groups. That s at
    Message 1 of 11 , Jan 30, 2006
      iler_ml@... wrote:

      >"Thanh Han The" <hanthethanh@...> said:
      >
      >
      >>a minimal example would look like:
      >>,--------
      >>| some text $a' =
      >>| b'' + c'''$ some other text
      >>`--------
      >>and I wish to change it to
      >>,--------
      >>| some text $a^{\prime}=
      >>| b^{\Prime}+c^{\Trime}$ some other text
      >>`--------
      >>The boundary of math environment can be more, but the above
      >>case is the typical one that I would like to get it done.
      >>
      >>
      >
      >
      >I decided to give it it a try using quite unusual approach, namely
      >to rely on vim's TeX syntax parsing rules...
      >

      Hello!

      David Fishburn came up with SrchRplcHiGrp.vim, which allows one to do
      substitutes
      based on highlighting groups. That's at

      http://vim.sourceforge.net/scripts/script.php?script_id=848

      Let's see, to do what you're asking...

      1. Place cursor in middle of a texMath highlighting group
      :SRChooseGroup (this selects the texMath highlighting group)
      2. :%SRHiGrp "[^']\\zs'\\ze[^']","{\\\\prime}"
      3. :%SRHiGrp "[^']\\zs''\\ze[^']","{\\\\Prime}"
      4. :%SRHiGrp "[^']\\zs'''\\ze[^']","{\\\\Trime}"

      Regards,
      Chip Campbell
    Your message has been successfully submitted and would be delivered to recipients shortly.