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

2

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

cwd

Posted 2012-01-21T21:33:34.427

Reputation: 13 508

1These 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 – 2012-01-21T21:49:45.960

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 – 2012-01-22T06:55:54.110

>

  • 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 – 2012-01-22T07:23:03.483

    Sorry, I was too lazy to type the whole shortcut. – romainl – 2012-01-23T07:57:39.143

    Answers

    1

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

    but take a look at

    /Applications/TextMate.app/Contents/SharedSupport/Bundles/Perl.tmbundle/Syntaxes/Perl.plist
    

    ...and u will find...

    Picture 12.png

    Steve Brown

    Posted 2012-01-21T21:33:34.427

    Reputation: 693

    0

    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

    tim

    Posted 2012-01-21T21:33:34.427

    Reputation: 329