In the bottom of my TextMate window I have a list of languages I can select by using the mouse or hotkeys. For some reason PHP does not have a hotkey associated with it, and I can't figure out where to set it. I've looked through the bundle editor without much luck.

How can I set a shortcut key for selecting the PHP language in TextMate?

enter image description here

  • 1
    These almost seem to be hardcoded, since there's no documentation on how to set keyboard shortcuts for custom language definitions. Weird that they would choose Perl over PHP, actually. Might be possible by some ugly User Interface scripting though. – slhck Jan 21 '12 at 21:49
  • Did you look at the other shortcuts? P is bound to 4 languages, R to 4, S to 2… adding a 5th language to P would only make the shortcut even less useful than it is. Anyway, PHP is automatically selected for PHP files, what kind of files are you working with? – romainl Jan 22 '12 at 6:55
  • 1) I didn't ask how to set it to "P" ;) 2) When you create a new file it would be nice to be able to set the language with a shortcut key before saving - or perhaps I don't even want to save it as a file - but I do want syntax highlighting. 3) Keyboard shortcuts with the same letter give you the 1-x menu which I don't really find to be that much of an extra step. – cwd Jan 22 '12 at 7:23
  • Sorry, I was too lazy to type the whole shortcut. – romainl Jan 23 '12 at 7:57

if there is no way to change it in the interface perhaps it is hard coded as slhck mentioned...

but take a look at


...and u will find...

Picture 12.png


In Textmate 2 you can change this in the UI

^⌥⌘-B, navigate to your bundle's language grammar, and add a Key Equivalent in the side bar.

By convention, these are always ^⌥⇧-X, where X is the First letter of the name of the language

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.