You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Completion algorithm: try prefix, fallback to fuzzy if, and only if, prefix gives no results #11211
Hmmm, I'd have to try it out to see if it fits. Seems like it would be ok, but I just don't know. I could see them named prefix, fuzzy, or fallback and fallback means its set to prefix, falling back to fuzzy.
Hi! Sorry for hijacking the thread (I found it by keyword "fuzzy"), but it didn't seem worth it to create a new issue.
So I have a question: what exactly is the difference between "prefix" and "fuzzy"? E.g. in fish I can type any substring, e.g. argo, and press Arrow-Up, and it will start scrolling over past commands that contained it (e.g. cargo run, which cargo etc.). But unfortunately, I can't get the same behavior in nu whatever I do: at first I expected that this fuzzy option will enable this behavior, but it did not. Then I gave up and enabled fish completer as an external one, but it didn't work either :( Thanks!
@fdncred Thanks a lot for looking into this! A couple more questions though, if you don't mind :)
I can see there is SubstringSearch enum variant there, so my example with argo would still be expected to work, wouldn't it?
could you elaborate on the difference between this SubstringSearch and fuzzy search, please? The fuzzy one would be expected to find other history items within a given Levenshtein distance, or I understand it wrong?
and generally speaking, this behavior (scrolling through history items after typing something in the shell and pressing Arrow-Up) logically belongs to history or to completions?
Thank you!
I'm guessing all of this is a reedline thing vs a nushell thing but could be wrong.
I think so? i haven't messed with this much.
substring maybe should work like argo. fuzzy would work like typing gco and matching git checkout
i think what you're looking for is history vs completions because you don't want to scroll through completions, you want to see the next history result that matches what you type.
Users’ expectations regarding completion for different parts of the command line are rarely one-size-fits-all. For me, the problem with the current completions.algorithm is that fuzzy often results in redundant command/argument suggestions, whilst prefix, conversely, leads to no results for (fallback) path completions. Furthermore, for up-arrow key completion (from command history), Fish’s substring matching is more intuitive (than Nushell’s prefix-only approach).
@fdncred I think merging #18761 closed this issue by mistake - it doesn't seem to me that it implements the "prefix-to-fuzzy" completion algorithm.
I would be interested in implementing this behavior. Please let me know if you think this would be a welcome contribution and perhaps reopen the issue?
Activity
fdncred commentedon Dec 2, 2023
Hmmm, I'd have to try it out to see if it fits. Seems like it would be ok, but I just don't know. I could see them named
prefix,fuzzy, orfallbackand fallback means its set to prefix, falling back to fuzzy.curldivergence commentedon Mar 25, 2024
Hi! Sorry for hijacking the thread (I found it by keyword "fuzzy"), but it didn't seem worth it to create a new issue.
So I have a question: what exactly is the difference between "prefix" and "fuzzy"? E.g. in
fishI can type any substring, e.g.argo, and press Arrow-Up, and it will start scrolling over past commands that contained it (e.g.cargo run,which cargoetc.). But unfortunately, I can't get the same behavior innuwhatever I do: at first I expected that thisfuzzyoption will enable this behavior, but it did not. Then I gave up and enabledfishcompleter as an external one, but it didn't work either :( Thanks!fdncred commentedon Mar 25, 2024
@curldivergence I'm not sure it works like that right now. I quickly looked into reedline and found this section which seems to indicate History Navigation with a Fuzzy algorithm isn't implemented yet.
https://github.com/nushell/reedline/blob/6957b5ab7b98c3f090131e9388c18c1826812314/src/history/base.rs#L7-L16
We may accept a PR to implement such a feature. I don't remember anyone asking for it though, before you.
curldivergence commentedon Mar 25, 2024
@fdncred Thanks a lot for looking into this! A couple more questions though, if you don't mind :)
SubstringSearchenum variant there, so my example withargowould still be expected to work, wouldn't it?SubstringSearchand fuzzy search, please? The fuzzy one would be expected to find other history items within a given Levenshtein distance, or I understand it wrong?Thank you!
fdncred commentedon Mar 25, 2024
I'm guessing all of this is a reedline thing vs a nushell thing but could be wrong.
argo. fuzzy would work like typinggcoand matchinggit checkoutcurldivergence commentedon Mar 25, 2024
@fdncred Got it, thanks a lot for you help!
tobiasBora commentedon Dec 18, 2025
Out of curiousity, why don't we allow the user to write custom completion algorithm?
unnamedname commentedon Apr 28, 2026
Indeed, another nice thing to have from Fish.
Users’ expectations regarding completion for different parts of the command line are rarely one-size-fits-all. For me, the problem with the current
completions.algorithmis thatfuzzyoften results in redundant command/argument suggestions, whilstprefix, conversely, leads to no results for (fallback) path completions. Furthermore, for up-arrow key completion (from command history), Fish’s substring matching is more intuitive (than Nushell’s prefix-only approach).flying-sheep commentedon Jul 27, 2026
Fuzzy can be quite confusing, but I guess that’s only when things are broken.
E.g. I use the
fishcompleter forgitbut failed to installfishon a system. I also haveSo completing
gitwith “fuzzy” gave meyarn plugin import from sourceslol.But maybe that just means that fuzzy isn’t for me as it kinda always gives something.
HUGE COMPLETER WORK (WIP) (nushell#18761)
j-chmielewski commentedon Aug 12, 2026
@fdncred I think merging #18761 closed this issue by mistake - it doesn't seem to me that it implements the "prefix-to-fuzzy" completion algorithm.
I would be interested in implementing this behavior. Please let me know if you think this would be a welcome contribution and perhaps reopen the issue?
fdncred commentedon Aug 12, 2026
@j-chmielewski ya, have at it?
@philocalyst thoughts on the comment just above? Was this issue closed by mistake?
kronberger-droid commentedon Nov 14, 2026
Status on 0.117:
algorithmacceptsprefix,fuzzyandsubstring.The fallback is open as #18965.