Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lost syntax highlighting in Textmate

Using Textmate, I have somehow managed to turn off syntax highlighting for php files. After much trial and error, I have worked out that this happened when I accidentally hit SHIFT-CTRL-OPTION-D (I'm on a Mac, btw). I've looked everywhere and tried many key combinations, but I cannot figure out how to re-enable the nice syntax highlighting. Please help me, Textmate gurus, you're my only hope!

like image 259
SaganRitual Avatar asked Dec 01 '12 01:12

SaganRitual


People also ask

How do you highlight syntax?

Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms.

What is syntax highlighting style?

Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.

What is textmate grammar?

TextMate grammars are supported by several popular text editors. They provide a set of regex (regular expression) patterns which are assigned scopes. These scopes are then turned into the CSS classes that you can target in syntax themes.


2 Answers

The key sequence SHIFT-CTRL-OPTION-D corresponds to an option in the language menu down at the bottom left of the Textmate window. The language menu tells Textmate what language to consider the file so it can determine the proper syntax highlighting. The key sequence I hit caused Textmate to highlight my text as though it were a diff window. Switched it back to PHP and it works great now.

like image 63
SaganRitual Avatar answered Oct 13 '22 04:10

SaganRitual


I don't have enough rep to add a comment, so I'll expand on the accepted answer here.

SHIFT+CONTROL+OPTION+<LETTER> will display a menu showing all grammars beginning with <LETTER>. So if you want PHP back, just hit SHIFT+CONTRL+OPTION+P, and then a list of languages beginning with 'P' will pop up. You can choose one from the list by pressing the corresponding number (on my computer, it's 2).

like image 20
xfactorial Avatar answered Oct 13 '22 06:10

xfactorial