Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Don't think bash accepts plugins like zsh does, so it may require a custom build of the bash shell/binary. Any reason not to just use fish instead? Also, thanks for pointing me to another shell to play around with and see if I can learn some advanced features of haha. –  Matrix Mole Jul 11 '11 at 1:47
    
@Matrix: I can't use fish because I have a very complex bash configuration that I couldn't give up. –  Wuffers Jul 11 '11 at 1:54
    
I completely understand on complex configurations, and wish you luck in your search. –  Matrix Mole Jul 11 '11 at 2:05
    
Unfortunately, I don't think that this is currently possible in bash. I'm sure that the research that you've done points to that as well. If you absolutely cannot switch to zsh, then that's understandable, but otherwise you may want to look at fizsh which incorporates some fish-like features into zsh, although it hasn't been updated since February, so perhaps the zsh-syntax-highlighting link that you provided would be more robust. –  voithos Jul 19 '11 at 18:34
add comment

1 Answer

I dont think syntax highlighting should happen at the shell level but at the interface level (just my opinion -and someone else's it seems-), so I would look into "plugins" for Terminal or your favorite console, for example this plug in for Kate might help, or this other one which offers syntax highlighting in nano

Here is still more talk about how to syntax highlighting in Terminal:

Add alias ls='ls -G' to .bash_profile.

although here is better explained the how to

Hope it helps

share|improve this answer
    
It looks like you're answering how to set up syntax highlighting in editors, not in the shell. The ls-colorization isn't even "syntax" highlighting. –  Kyle Strand Mar 25 at 23:11
    
I think you're focusing on semantics more than on the solution, with the code from the links and suggested solution I get colors in bash, which I believe is what the OP wanted to know –  Purefan Mar 26 at 12:03
    
The original question is actually quite clearly about actual syntax highlighting. This is shown both by the screenshot of the fish shell and the final sentence: "I want to highlight the actual text that is entered at the terminal. The commands, parentheses, quotes, etc." –  Kyle Strand Mar 26 at 16:18
    
Can you explain why none of the two last links that I provided help in this case? –  Purefan Mar 27 at 15:32
    
As I said, it's not "syntax" highlighting. Those are highlighting the output of the ls command based on file type, which has nothing to do with shell syntax. –  Kyle Strand Mar 27 at 20:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.