Sublime Forum

Real Time Regex Highlighting

#1

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.

0 Likes

#2

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.

0 Likes

#3

hmm… doesn’t work for me

0 Likes

#4

no… can you say what you press and on which context, what to expect etc.

0 Likes

#5

hehe, nevermind, later.

0 Likes

#6

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.

0 Likes

#7

did you try ctrl+i instead of ctrl+f?

0 Likes

#8

That is pretty close to what I want thanks. Now if other all other occurrences were highlighted as well :smiley:, 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.

0 Likes

#9

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:

pastie.org/private/cggy1ihxlpvpwnwmv3b0qa

and add the following key binding:

<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:

<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:

<dict> <key>name</key> <string>Basic</string> <key>settings</key> <array>

0 Likes

#10

this is one of the things why i have not switched from e to sublime yet…

0 Likes

#11

this works in the latest beta. :smile:

0 Likes