syntax highlighting for ls command and vim editor
I really like syntax highlighting in the Linux terminal for the ls command and in Vi or Vim. Mac OS X, it seems, doesn't have syntax highlighting as a default. It took me a little time to learn how to get it enabled, permanently, in OS X, so I thought I would share this with anyone else in case they want to enable it in Panther also, using the bash shell.
If you don't know what I'm talking about, in Panther, in the terminal, type ls -G. Files, directories, links, etc. are colorized differently. In order to make this permanent, in terminal, open the .bash_profile file, I use Vi, in your home directory and add these aliases:
alias ls="ls -G"
alias ls -l="ls -lG"
alias ls -al="ls -alG"
To enable syntax highlighting for Vi, I had to create a file called .vimrc in my home directory. Some people seem to have this file by default, I didn't. To create the file, type:
Add the following line to the file:
Make sure your Terminal preferences are set to "xterm-color" as your terminal type. Usually this is default, but the easiest way to check: in the Terminal menu bar, scroll down to Preferences and open it or press the Command and comma button at the same time.
Log out and log back in for changes to take effect.
Last edited by cseanburns; 01-02-2005 at 03:16 AM.