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

Re: Search and replace using syntax groups

Expand Messages
  • Charles E. Campbell, Jr.
    ... There s no such tie-in into the regular expressions. However, if you look into , there s a function in it (SpchkNxt()) that moves the cursor
    Message 1 of 2 , Nov 28, 2003
    View Source
    • 0 Attachment
      David Fishburn wrote:

      >Vim 6.2.154
      >
      >I have a SQL file with all the keywords highlighted yellow.
      >I want to perform a search and replace to change all the yellow words to
      >uppercase.
      >I was thinking something like this:
      >%s/\(\<\k\+\>\)/\1\U/g
      >
      >Assuming I could replace the keywords with a syntax (base) group.
      >
      >

      There's no such tie-in into the regular expressions.
      However, if you look into <engspchk.vim>, there's
      a function in it (SpchkNxt()) that moves the cursor
      to the next item that's highlighted in "Error".

      You should be able to modify it to:

      * search for the highlighting for your keywords
      * capitalize the keyword following the cursor
      ie. s/\%#\(\k\+\>\)/\U\1/
      * repeat until done
    Your message has been successfully submitted and would be delivered to recipients shortly.