I have spent a weekend hacking Sublime to give me basic emacs functionality. I know other packages already exist but they didn’t really do things quite right, and in many ways Emacs got many of the basics just absolutely right. It was a successful weekend of hacking and I am still learning.
I like the incremental find that comes with Sublime, but it is missing a couple of features. The main ones for me are:
- if I type ctrl+s immediately after the first one, it should use the same search string that I ended with last time
- if I type ctrl+w it should append the text in front of the cursor to the current search string
- if I search for a MixedCase item, the search automatically becomes case sensitive, otherwise case insensitive
- when it’s done I should be able to get a notification so I can set the mark at the original location
- I’d love a way to say “find the rest in this direction without wrapping” so I can then go all multi-cursor on the ones I’ve selected
I realize these are all personal taste so I am happy to implement it myself, but I either need to start from scratch (is that possible?) or I need a way to get hooks into what is happening in the incremental_find panel. I am unclear on how to do either.
Here are a few observations and comments about what I think I have learned so far:
- I think it’s a regular view inside the incremental_find panel. My text command event listener seems to be invoked when I run commands there. That is excellent! At first I thought the panel was a complete special case.
- If I put a “context” in my key binding such that it’s only active if the incremental_find panel is showing and has focus, I don’t seem to be getting my function called. Should that work?
- If that does work, would the view argument be the view for the incremental find or the active view of the active window?
- Is there a way to capture all key strokes? I want to be able to terminate my incremental search if I type some other command, like Control-A.