ggandor / lightspeed.nvim

deprecated in favor of leap.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Repeat last search by pressing the same letter again

muhmud opened this issue · comments

Would be possible to allow repeating the last f search, for example, by pressing the same letter that I searched for, rather than pressing f again. I always seem to do this intuitively, and my finger is already in the exact right place.

So, if I do fa, I want to be able to get to the next match by pressing a again, rather than f.

Do you think this would be a good idea / viable? I guess the downside would be that you have to escape out before being able to use the search letter for a non-search operation.

It's just two lines of code I guess, but

the downside would be that you have to escape out before being able to use the search letter for a non-search operation.

Yeah. Also, f is consistently f, that is, easy to press, but in case of this system, all bets are off, you might need to press something with your pinky 2-4 times, would it worth it?

I might try this out for fun though, who knows.

Would be great if there was a config to support it; for some reason my brain is wired for this!

I tried it. I think this feature is awesome in general, but I don't know how annoying it would be on those few occasions when we want to use the search char as the next command... I guess super-annoying. And needing to keep in mind that you might have to escape kinda spoils the whole thing. So even though it's a super-lightweight addition (being one additional line in the algorithm, plus a config flag), I'm not completely sold on the idea yet.

Try this yourself! Just change the following line in the compiled lua file

local repeat_3f = ((vim.fn.maparg(in2, mode) == get_plug_key("ft", false, t_mode_3f)) or (in2 == repeat_key))

by adding ... or (in2 == in1)) to the end of the expression.

First impressions: too cool, and I think I could get used to Esc and then the letter when I want the actual operation rather than repeat the search. Another thing I was concerned about was searching for characters like " where it needs a modifier, however, this doesn't feel so bad either.

Will run with it for a bit and let you know :)