Ny way to get bash to have syntax highlighting like fish

bashfishsyntax highlighting

In the fish shell, the actual command line is syntax highlighted:

enter image description here

Is there any way to get this same behavior in bash?

There is something just like this but for zsh, not bash. Is it possible that this could be ported to bash?

To clarify for those who don't understand the screenshot, explanation, or link provided: I want to highlight the actual text that is entered at the terminal. The commands, parentheses, quotes, etc.

Best Answer

Bash uses readline for interactive input, so syntax highlighting would need to be implemented in that program. I found a Google Groups discussion about how to code such a feature.

The fish shell uses its own line editor that is specific to that program, and can not be directly ported.

You may find that zsh is very similar to bash, and its line editor is extendable. I found zsh-syntax-highlighting to enable this feature in zsh.

Related Question