Search code examples
shellfish

Some questions related the autocompletion of the fish shell


When typing the beginning of a command in the fish shell the most recent (or frequently?) possible completion of the command is visible in dark grey.

Say I type:

fish

in dark grey: _config is appended.

at this time it is not yet evident, what I'm about to do. So the TAB key shows me all possible completions of 'fish'

I can keep on typing characters, until it's clear what I want. E.g: _con

Now there is only one option to which this could be completed. So I can hit the tab key to see fish_config. However: this was not indicated somehow. In other words: After typing fish_con nothing really tells me that I don't have to keep on typing. Is this the case? Wouldn't this be extremely helpful?

Second question: What is the actual sense of the grey characters? I'd only understand their purpose if there was a way to accept this propose. After typing f, I'd expect a key combination that immediately fully completes to the propose in grey: fish_config.

Even better would be the option let the grey letters cycle through all options, or possible completions based on the history.


Solution

  • The characters to the right of the cursor are called the autosuggestion. They are gray to indicate that they are not actually part of the command, just a suggested completion of what you've typed so far.

    So I can hit the tab key to see fish_config. However: this was not indicated somehow. In other words: After typing fish_con nothing really tells me that I don't have to keep on typing

    This sounds like you have an idea for an indication when the partial command is a unique prefix of another command. I am not sure what UI you have in mind - what would the indication look like? Please feel welcome to open an issue with your UI ideas.

    However if your command is unique, the autosuggestion will always contain it.

    Second question: What is the actual sense of the grey characters? I'd only understand their purpose if there was a way to accept this propose. After typing f, I'd expect a key combination that immediately fully completes to the propose in grey: fish_config.

    You can accept the autosuggestion by hitting right arrow or control-F. Tab shows you all possible completions, and up arrow lets you cycle through matching history.

    You may want to read the fish tutorial, which covers autosuggestions here: http://fishshell.com/docs/current/tutorial.html#tut_autosuggestions