Home Download Buy Blog Forum Support

Real Time Regex Highlighting

Real Time Regex Highlighting

Postby AKWintermute on Sat Oct 17, 2009 6:36 am

It would be great if as you typed in a regular expression it highlighted what would be selected in the document. This is the only feature I miss from EditPad Pro, and it greatly speeds up and allows me to build complicated regular expressions. Otherwise I think Sublime Text is a wonderful editor. I guess this would be good for non-regular expression searches as well.
AKWintermute
 
Posts: 4
Joined: Sat Oct 17, 2009 6:31 am

Re: Real Time Regex Highlighting

Postby jps on Sat Oct 17, 2009 6:58 am

Incremental search (Ctrl+I) can do this to some degree, although it will only show you the first match, rather than all of them. Regex mode will be initial disabled when the panel opens, but it can be turned on afterwards.
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Real Time Regex Highlighting

Postby vim on Sat Oct 17, 2009 8:12 am

hmm... doesn't work for me
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Real Time Regex Highlighting

Postby vim on Sat Oct 17, 2009 8:34 am

no... can you say what you press and on which context, what to expect etc.
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Real Time Regex Highlighting

Postby vim on Sat Oct 17, 2009 9:15 am

hehe, nevermind, later.
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Real Time Regex Highlighting

Postby AKWintermute on Mon Oct 19, 2009 8:07 pm

The real gist is that I don't want to do a "search" (press or keyboard combo) each time I change the search text, I just want the selection/highlight to change as I type. If there was an event handler for the search text box similar to the on-change event handler in javascript for HTML inputs we could write a custom plug-in to handle the event. Since I'm new to Sublime I was unable to find anything in the API, perhaps one of you more familiar can point me in the right direction.
AKWintermute
 
Posts: 4
Joined: Sat Oct 17, 2009 6:31 am

Re: Real Time Regex Highlighting

Postby vim on Mon Oct 19, 2009 9:44 pm

AKWintermute wrote:The real gist is that I don't want to do a "search" (press or keyboard combo) each time I change the search text, I just want the selection/highlight to change as I type. If there was an event handler for the search text box similar to the on-change event handler in javascript for HTML inputs we could write a custom plug-in to handle the event. Since I'm new to Sublime I was unable to find anything in the API, perhaps one of you more familiar can point me in the right direction.


did you try ctrl+i instead of ctrl+f?
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Real Time Regex Highlighting

Postby AKWintermute on Tue Oct 20, 2009 5:19 pm

That is pretty close to what I want thanks. Now if other all other occurrences were highlighted as well :D, just being picky. Is there a concept in sublime of a highlight vs a selection? Seems like a few of the topics talk about using highlight, but not wanting to make a selection. Seems like it would be used if it was available.
AKWintermute
 
Posts: 4
Joined: Sat Oct 17, 2009 6:31 am

Re: Real Time Regex Highlighting

Postby vim on Tue Oct 20, 2009 5:54 pm

regarding highlighting, this was much discussed and requested by us - the users, there have been some progress on latest beta, with experimental API, i have posted on another topic, but you can try this:

http://pastie.org/private/cggy1ihxlpvpwnwmv3b0qa

and add the following key binding:
Code: Select all
   <binding key="ctrl+shift+keypad_multiply" command="stickySearch set" />
   <binding key="ctrl+shift+keypad_plus" command="stickySearch add" />
   <binding key="ctrl+shift+keypad_minus" command="stickySearch clear" />


To set the highlight color, add to your theme file the following:
Code: Select all
      <dict>
         <key>name</key>
         <string>Marker</string>
         <key>scope</key>
         <string>marker</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#FFFF77</string>
         </dict>
      </dict>


it should be added inside the scope of:
Code: Select all
<dict>
   <key>name</key>
   <string>Basic</string>
   <key>settings</key>
   <array>
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: Real Time Regex Highlighting

Postby myel on Tue Oct 27, 2009 8:48 pm

this is one of the things why i have not switched from e to sublime yet...
myel
 
Posts: 88
Joined: Sat Mar 22, 2008 11:26 pm

Next

Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 3 guests