Macos – Coloured commands in iTerm

iterm2macosterminal

Previously I had a friend to set up my iTerm2 environment for me, and I got used to it. Since I changed computers, I now have to setup my environment again.

I used to use ir_black as my iTerm2 theme, and one of the functions it had was that if the command I typed is available, it turns green.

However, it seems that I am unable to replicate that even after installing new colour themes. Am I looking at a wrong direction?

Here's an image of how my terminal looks like this:
enter image description here

Best Answer

man ls has additional information on color listings.

Using the -G flag with ls ought to enable colour, if your shell's $TERM environment is set to a colour-capable value.

To have colour listings be the default of ls, the CLICOLOR environment variable can be set (to anything, even '') in the appropriate login script file.

It's either done like this:

CLICOLOR=''; export CLICOLOR

or

setenv CLICOLOR

depending on what login shell you use.


For interactive as-you-type colourizations...

There are quite a few add-ons for the zsh shell. A google search on "color completion zsh" will return dozens of articles on how to set up coloured prompts and file-completion.

I did come across a reference to fish, a Friendly Interactive Shell. I installed it on my Mac, and it appears to work as you've indicated.

If which fish gives a Command not found error, you'll have to install it from the official fish homepage.

Related Question