6

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

1
  • I doubt that your friend's setup has anything to do with iTerm2 color schemes. It sounds more like a shell function. E.g. check out this code for zsh: zsh.org/mla/users//2010/msg00709.html
    – mpy
    May 29, 2014 at 16:37

2 Answers 2

0
+50

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.

6
  • actually what I am referring to is the command itself. Note how ll is in green, note white, and also my git is in red (because there's changes). If I type in an invalid command, say, cf, it will appear as red not green
    – He Hui
    May 26, 2014 at 8:03
  • What login shell do you use? May 26, 2014 at 9:18
  • I am using iTerm2. Is that what you are asking?
    – He Hui
    May 26, 2014 at 9:52
  • show me the output from this command: tty ; ps May 26, 2014 at 10:41
  • 1
    Your login shell is /bin/zsh for future reference. May 26, 2014 at 11:36
2

Since you are using the zsh shell this is what you are looking for: zsh-syntax-highlighting.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .