Share your knowledge at the LQ Wiki.
Go Back > Forums > Other *NIX Forums > Other *NIX
User Name
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.


  Search this Thread
Old 01-02-2005, 03:11 AM   #1
Registered: Nov 2003
Distribution: Debian, Ubuntu, Fedora
Posts: 129

Rep: Reputation: 23
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:

vi .vimrc

Add the following line to the file:

:syntax enable

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
RdHat Vim Syntax Highlighting R4z0r Linux - Software 8 09-06-2011 01:22 PM
vim syntax highlighting MiniMe001 Linux - General 2 06-19-2005 11:08 AM
Adding Syntax Highlighting to VIM TastyWheat Linux - Software 2 02-27-2004 03:37 AM
How to make vim has syntax highlighting ICO Linux - General 4 01-05-2004 10:35 AM
Vim syntax highlighting NSKL Linux - Software 2 11-09-2002 02:39 AM > Forums > Other *NIX Forums > Other *NIX

All times are GMT -5. The time now is 02:36 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration