Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently changed my Mac OS X Terminal colors.

How can I enable syntax highlighting for pico? Or any editor in general?

share|improve this question

migrated from Mar 11 '11 at 1:33

This question came from our site for power users of Apple hardware and software.

Not really a Mac question? – Wuffers Mar 10 '11 at 3:50
Not specifically a Mac question, no. – VxJasonxV Mar 10 '11 at 18:55
@VxJasonxV: My last comment was migrated from Apple.SE along with the question. Just to let you know. – Wuffers Mar 11 '11 at 2:11
I know. But good clarification for everyone else. My comment was from too! – VxJasonxV Mar 11 '11 at 2:14

pico does not have syntax highlighting. Other text editors each have their own specific methods for enabling syntax highlighting.

share|improve this answer
OP may be interested in GNU nano, which is very similar to pico, and supports syntax highlighting. – ephemient Mar 11 '11 at 2:14
Nah. You just know he wants to jump into emacs face first. – Ignacio Vazquez-Abrams Mar 11 '11 at 2:15
Insert obligatory: "I'm sorry, I think you mean Vim." – VxJasonxV Mar 11 '11 at 2:19
I'm actually considering re-learning vi or pick up emacs. I'm still looking for reasons to lean towards one. – Doug Mar 11 '11 at 9:38
The OSX terminal has nano. How can I enable syntax highlighting for nano? – Doug Mar 11 '11 at 9:40

This is old, but I feel it could still be elaborated on a bit.

As mentioned, pico does not have syntax highlighting but nano does, as well as vim (although that is a significantly different editor!).

The short version: Add the line include /usr/share/nano/* to ~/.nanorc and create the file if it doesn't exist.

The long version: nano stores its syntax highlighting in a global directory, most likely somewhere like /usr/share/nano/ (This is the default on my Debian based machines). Highlighting files are split up by type, so highlighting for the 'C' language would be located in /usr/share/nano/c.nanorc. Highlighting can be enabled by using an include statement, either in the global config file /etc/nanorc or the user config file ~/.nanorc. You may include each file individually by include /usr/share/nano/c.nanorc OR use a wildcard operator and include all files in the directory by using include /usr/share/nano/*

A quick note on vi and vim - many systems come with vi installed by default, which does NOT support syntax highlighting. If vim is installed, then syntax highlighting can be turned on by adding syntax on to either the global config file at /etc/vim/vimrc or the user config file ~/.vimrc

share|improve this answer

Per Pico's Wikipedia Article, Pico did not have Syntax Highlighting, nano does. According to nano's site, it's a compile time option, and then if memory serves it will just work based off extension or file content.

Vim is generally syntax highlighted by default, but may take some special black magic in order to invoke it in case it's not. (set nocompatible, launch via vim instead of vi, syntax on and set syntax=$lang, etc.)

Most X/Visual text editors will automatically syntax highlight.

Any specific ones you're also interested in?

share|improve this answer

You must log in to answer this question.

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