> -----Original Message----- > From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] > Sent: Monday, October 02, 2006 7:44 AM > To: Marius Roets > Cc: vim@vim.org > Subject: Re: Uppercase keywords > > Marius Roets wrote: > > Hi Vimmers, > > I have a big a (3000+ lines) source code file. The syntax > highlighting > > works perfectly, so all keywords are highlighted correctly. > Is there > > any way that I can use this fact to convert all keywords to > uppercase, > > or do I have to do them all one by one? > > > > Thanks > > Marius > > > > I think it should be possible to write a function or command > to put the cursor on each word in turn, determine if it is a > keyword, and depending on the result, do either nothing or > "normal gUaw" (without the quotes). You may want to do this > within a visual highlighted area (i.e., from mark `< to mark > `> ) or as a command accepting a range (like the :s command).
Right you are Tony, that is exactly how I wrote it. SrchRplcHiGrp.vim - Search and Replace based on a highlight group http://www.vim.org/script.php?script_id=848 Basic usage: Place your cursor on the highlighted text. :SRChooseHiGrp It tells you what it found: SRHiGrp - Group ID: 268 Name: vimLet Or: :SRChooseHiGrp! SRHiGrp - Group ID: 49 Name: Statement Add the ! if you want the base color. Then you can visually select the region you want, the plugin supports all 3 visual modes (characterwise, linewise and blockwise). Then run: :'<,'>SRHiGrp It asks you for 2 pieces of information: 1. What to match (via a regex) default is current word - '\(\w\+\>\)' 2. What to do with the match. The default is to UPPERCASE the match - '\U\1' You can also use this plugin to just search for highlight groups using the SRSeach command. :h SRHiGrp Enjoy, and please rate it if you find it helpful. Feedback is always welcome. Dave finds - '\(\w\+\>\)'