fish-shell icon indicating copy to clipboard operation
fish-shell copied to clipboard

Make autosuggestions from history case-insensitive

Open ivofrolov opened this issue 9 years ago • 16 comments

For instance, I have directory named Projects in current workind directory. When typing cd pro fish suggests Projects/ as possible completion based on directory name. But when I type cd Pro shell suggests Projects/myproject string from history.

I think it would be more convenient to search for possible completions from history case-insensitively.


Fish version: 2.3.0 Operating system: OS X, Homebrew Terminal or terminal emulator: OS X Terminal

ivofrolov avatar Jun 08 '16 22:06 ivofrolov

Seems reasonable to me. Most search engines default to case-insensitive and may not even provide a case-sensitive search option. Having fish behave the same way is likely to be less surprising, and thus friendlier, for people used to Google, etc.

krader1961 avatar Jun 08 '16 22:06 krader1961

Hello, I wish to work on this bug. I haven't contributed to fish-shell before.

nitsakh avatar Mar 06 '17 03:03 nitsakh

I haven't contributed to fish-shell before.

That's okay. We're always interested in seeing people contribute to the core C++ code. We're happy to get you pointed in the right direction by answering questions specific to this project such as how to run unit tests, acceptable code style, etcetera. We're not, however, going to teach you how to use git or program in C++ :smile:

krader1961 avatar Mar 06 '17 04:03 krader1961

See also issue #2538 which is closely related.

krader1961 avatar Mar 16 '17 04:03 krader1961

Hi, just wanted to let you know that I really like this behaviour! If I want to lookup the history case insensitive - I just type small letters. And since most of my Directory paths are starting uppercase I can easily search for them with the first letter uppercase. So if this is going to be changed, please make it configurable.

j0d5 avatar May 12 '17 08:05 j0d5

Sorry! I've been pretty busy lately and haven't got to this yet. If someone else is willing to take this up, feel free to do so.

nitsakh avatar May 16 '17 23:05 nitsakh

Can I help with this? I really love using the fish shell, and would like to contribute to it :smile:

BK1603 avatar Oct 04 '18 21:10 BK1603

Sure! Awesome! Please start by describing the behavior you'd like though. For example I'm not sure about suggesting command names in a case insensitive way.

ridiculousfish avatar Oct 06 '18 23:10 ridiculousfish

Yeah sure, I think the filenames could be case sensitive, also like while I am at it, I have one other idea/feature request, like while we are in the middle of an incomplete or a half written command, and the shell suggests a completion, could some keybinding automatically execute it? I won't say that pressing enter should 'cause, well, a command like cd could have a lot of suggestions but would work on its own too..

BK1603 avatar Oct 07 '18 17:10 BK1603

@BK1603 you can make your own key binding if you want to accept and execute. For example here with control-F:

bind \cf accept-autosuggestion execute

ridiculousfish avatar Oct 10 '18 01:10 ridiculousfish

Any fix for this should respect existing fish convention with regards to case: case insensitive options should only be shown if no case-matching options are extant/viable.

mqudsi avatar Oct 17 '18 01:10 mqudsi

That's the existing behavior, or at least the intended behavior. See completions_sort_and_prioritize where we try to preserve only the "best" completions.

ridiculousfish avatar Oct 17 '18 05:10 ridiculousfish

if no one is working on this I'm gonna take it up so lmk if you are currently working on implementing this

skhatib07 avatar Jan 19 '22 02:01 skhatib07

Sounds good. Probably you should describe your proposed UI changes, before you get too far into implementation.

ridiculousfish avatar Jan 23 '22 21:01 ridiculousfish

For the time being, I just wanted to try to make it so the autosuggestion for a lowercase word is the same as the autosuggestion for that same word as an uppercase word. For example, When typing cd pro I want the autosuggestion to be the same as typing cd Pro or typing cd PRO

skhatib07 avatar Jan 30 '22 21:01 skhatib07

For the time being, I just wanted to try to make it so the autosuggestion for a lowercase word is the same as the autosuggestion for that same word as an uppercase word. For example, When typing cd pro I want the autosuggestion to be the same as typing cd Pro or typing cd PRO

This already works: if the best completion is case-insensitive then it will use that. It works with cd and others. The exception is commands from history, which are always matched case-sensitive.

ridiculousfish avatar Feb 05 '22 21:02 ridiculousfish