Bash – Does Bash have similar features such as Fish’s autosuggestions and highlighting

bashfishshell

I recently noticed 2 features in Fish and was wondering if anyone knew if these were also available in Bash?

Syntax highlighting

ss #1

Specifics:

  • You'll quickly notice that fish performs syntax highlighting as you type. Invalid commands are colored red by default:
  • A command may be invalid because it does not exist, or refers to a file that you cannot execute. When the command becomes valid, it is shown in a different color
  • fish will underline valid file paths as you type them
  • This tells you that there exists a file that starts with 'somefi', which is useful feedback as you type.

Autosuggestions

ss #2

Specifics:

  • fish suggests commands as you type, and shows the suggestion to the right of the cursor, in gray.
  • It knows about paths and options
  • To accept the autosuggestion, hit right arrow or Control-F. If the autosuggestion is not what you want, just ignore it.

Best Answer

Unfortunatly not. But I predict, that bash will massively slow down if you try to implement these features. Perhaps that's why noone "ported" these features yet.

The nearest I found was https://github.com/dvorka/hstr, a shell suggestion box


aside bash:

I didn't tested it, but the only "ported alternative" that I found was written for zsh: https://github.com/zsh-users/zsh-autosuggestions

Some qwant'ing also lead me to https://websetnet.com/shell-packs-power-python-bash/ and https://github.com/xonsh/xonsh alias http://xon.sh, perhaps it also supports that out of the box

... but, I'm quite sure you're not interested in other alternatives to bash, because then you could just switch to fish ;)