How to Highlight Syntax in TextWrangler

Techwalla may earn compensation through affiliate links in this story.
Syntax highlighting changes the color of text based on its usage.
Image Credit: Janka Dharmasena/iStock/Getty Images

TextWrangler from Bare Bones Software provides automatic syntax highlighting when a document is detected to be in one of several standardized programming languages. Syntax highlighting will color the words of a document differently to make it easier to spot programming errors and other mistakes while typing. Syntax highlighting is controlled by the file extension.


Opening a New or Saved Document

Open the TextWrangler software by double-clicking on its icon if you wish to work with a new file. Existing files can be dragged and dropped onto the icon, and will automatically be syntax highlighted based on their file names.

Video of the Day

Choosing Document Highlighting

Save a new file to disk with a standard file name extension to activate syntax highlighting. For example, use "HTML or "HTM" for HTML files, "PHP" for PHP files, or "JS" for JavaScript files. Text typed into the document will now be highlighted by syntax.


Changing the Highlighting Dictionary

Choose a different highlight dictionary if the syntax highlighting does not activate as you expect. Choose "Text Options..." from the Edit menu, then select the correct highlighting parser from the Languages drop-down menu.

Setting Custom Colors

Change the colors used by syntax highlighting by choosing "Preferences..." from the TextWrangler menu, then clicking on "Text Colors." Click on any color swatch to bring up the color picker and select a new color for that category of text. When you have the colors set as you wish, click the "Save Scheme..." button to save your colors as a defined scheme set.