helix
helix copied to clipboard
add prompt history search by input
How about making this the default behaviour of up/down keys and instead of just matching by prefix we match by substring, similar to how fish shell does history searching:
↑ (Up) and ↓ (Down) (or Control+P and Control+N for emacs aficionados) search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match.
https://fishshell.com/docs/current/interactive.html#shared-bindings
How about making this the default behaviour of up/down keys and instead of just matching by prefix we match by substring, similar to how fish shell does history searching:
↑ (Up) and ↓ (Down) (or Control+P and Control+N for emacs aficionados) search the command history for the previous/next command containing the string that was specified on the commandline before the search was started. If the commandline was empty when the search started, all commands match.
https://fishshell.com/docs/current/interactive.html#shared-bindings
@sudormrfbin Changed, please take another look.
I like this behavior 👍
There's one difference from fish history navigation that I notice: if you hit down/C-n enough I think you should be able to get back to your original prompt. So if you have :open CHANGELOG.md
and :open README.md
in the history and have a prompt of :op
:
-
C-p
should give:open README.md
(current behavior ✔️) -
C-p
should give:open CHANGELOG.md
(✔️) -
C-n
should give:open README.md
(✔️) -
C-n
should give:op
(✖️: current behavior is the last item in history,:open README.md
)
so that if you don't like the options in the history you can continue from what you typed.
I like this behavior 👍
There's one difference from fish history navigation that I notice: if you hit down/C-n enough I think you should be able to get back to your original prompt. So if you have
:open CHANGELOG.md
and:open README.md
in the history and have a prompt of:op
:* `C-p` should give `:open README.md` (current behavior ✔️) * `C-p` should give `:open CHANGELOG.md` (✔️) * `C-n` should give `:open README.md` (✔️) * `C-n` should give `:op` (✖️: current behavior is the last item in history, `:open README.md`)
so that if you don't like the options in the history you can continue from what you typed.
Done, please take another look, thanks!
it seems that below test failed because of the behavior change, did I miss something? If not, please let me know how I shall update it.
Hello, anything I can do to help get this merged? I can have a go at fixing the tests if you'd like @QiBaobin?
Hello, anything I can do to help get this merged? I can have a go at fixing the tests if you'd like @QiBaobin?
Thanks, it would be great if you can help on this. And I think we also need get @the-mikedavis approve this.
It merged cleanly with master but I found a few problems with the matching logic so got those fixed up.
Helix master and vim both stop at the start and end of the lists, and your implementation keeps going around in a loop. I've left the loop in there but probably worth a quick discussion as to whether that's desired. (I think it's great.)
Tests + integration tests are passing locally for me, do you want to merge my branch into yours and see what CI thinks?
It merged cleanly with master but I found a few problems with the matching logic so got those fixed up.
Helix master and vim both stop at the start and end of the lists, and your implementation keeps going around in a loop. I've left the loop in there but probably worth a quick discussion as to whether that's desired. (I think it's great.)
Tests + integration tests are passing locally for me, do you want to merge my branch into yours and see what CI thinks?
merged to my branch, thanks! But It seems that the test still fail.
No go—it's late here but I'll check out the fail tomorrow morning.
Got it failing in a docker container, strange that it doesn't fail on MacOS. Fixed in 8059c10 on my branch if you'd like to merge.