Skip to content

/ & ? should repeat searches #146

Open
rufwork opened this Issue Jul 16, 2012 · 11 comments

5 participants

@rufwork
rufwork commented Jul 16, 2012

When I search in VIm, I can repeat the search for the same text by hitting "/" followed by enter or "?" followed by enter. In Vintage mode, a search for nothing is executed instead. And, like the trained ape I am, I keep hitting / over and over, waiting for the search to kick in.

So my expectation for an empty search in Vintage mode would be the same as hitting F3 or shift-F3 in Sublime Text without Vintage mode enabled.

(I looked through issues and didn't see this one -- some stuff about jumping, but nothing afaict on repeated searches.)

@vdanen
vdanen commented Jul 29, 2012

I'll agree with this one. I absolutely miss this feature of vim's when using SC2. Remembering the current search when re-calling '/' or '?' would be welcome!

@johnfn
johnfn commented Aug 7, 2012

Although this doesn't fix the issue, are you guys aware of n/N? n goes forward one match, N backwards one match. It's even a keystroke shorter :-)

@vdanen
vdanen commented Aug 10, 2012

No, I wasn't aware of this. That'll definitely be a good work-around if I remember it... fingers are "hard coded" for vim. =)

@cylon21
cylon21 commented Sep 10, 2012

I agree too!!
'n', 'N' is good, but I like '/' ,'?'
Most Vim users absolutely need this feature.

@guillermooo

The / search command uses the built-in ST2 panel. Making /<CR> work as described would require reimplementing the search panel altogether (as an input panel via the API). It's definitely desirable, but it hasn't been done yet.

@rufwork
rufwork commented Sep 10, 2012

@guillermooo Is there a way to remember what the last search was and prepopulate the ST2 search box when / or ? is hit? That's really all that's missing.

@guillermooo

Unfortunately, no :/. There's no search history/API to hook into or any known setting that provides that information... Also, if it was possible, I'm not sure that the semantics would be fine for non-Vintange users. Maybe there could be an independent setting for this, though:

empty_search_term_repeats_last": [bool] or something similar.

A search API would be best, though, since there must be more Vim tricks worth carrying over to Sublime Text.

@guillermooo

Also, this could be lumped into VintageEx. I'll think about it. I've never actually tried implementing the search function as an input panel. Jon mentioned it, so maybe it's possible to get quite far with the current state of the API.

@rufwork
rufwork commented Sep 10, 2012

Right -- if ST2 lets you set some sort of global var anywhere and pass a string to the search box, then it seems a kludge would be possible. I'll have to take some time to figure it out.

But sure, I'd love to see RegExp & s/findMe/ReplaceWithMe/gi style stuff work there too, so at some point a "real" solution like you're suggesting would be The Right Thing to do.

The n/N alternative isn't horrible for now. I guess if I get enough time to learn YA OM, I should see if I can figure out how to kludge a last search. Everyone seems to suggest ST2 is pretty easy to customize.

@guillermooo

But sure, I'd love to see RegExp & s/findMe/ReplaceWithMe/gi style stuff

Have you tried https://github.com/SublimeText/VintageEx? That should be working now ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.