TextMate for PHP Development
- mate filename1 filename2 - you can always start TextMate from command line and give list of files/folders to open
- open projectname.tmproj - if you saved your TextMate project to a file, which is good way to preserve custom project configuration, you can open it from shell with standard OSX open command
- Cmd + T - search for file in the project
- Cmd + Shift + F - search for a given string through all files in the project
- Cmd + F - regular search for a given string in current file
- Ctrl + S - faster way to search for strings in current file. Notice the input text box at the bottom of you TextMate window. Hit Esc to get out of fast search mode.
- Cmd + Shift + T - search for a function/class name in current file
- Cmd + Ctrl + R - see where the current file is in the project folder tree.
- Ctrl + W - select whole word under cursor
- Ctrl + Shift + A - gives you the list of SVN commands to execute on current file or folder if it is selected in project file tree.
- Ctrl + Shift + G - gives you the list of Git commands to execute on current file or folder if it is selected in project file tree.
- Alt + Mouse Selection - selecting in vertical blocks has never been easier, and editing afterwards as well
- Set of shortcuts for doing fast search and replace
- Cmd + E - set keyword to be replaced
- Shift + Cmd + E - set replacement word
- Ctrl + Cmd + F - replace in current file
- Ctrl + Shift + Cmd + F - replace in selection only
Great thing about TextMate is its possibility to be customized for specific needs by adding so called bundles. TextMate comes with default PHP bundle embedded. You can see all the functionalities it provides in TextMate -> Bundles -> Bundle Editor -> Show Bundle Editor or Ctrl + Alt + Cmd + B as shortcut. Here are some interesting ones from this bundle or useful for development in general
- Esc - hitting escape after you typed couple of letters will do code completion from the symbols defined in current editing file. Will work as well for native PHP functions. Just start typing mk and hit escape then and it will complete it asmktime :)
- Alt + Esc - this will give you list of possible completions. After selecting one of them, you’ll get full function signature injected in the document.
- Ctrl + H - will give you PHP documentation related to the selected word in your current editing document.
- Ctrl + Shift + V - will check your file for syntax validity.
- Shift + Cmd + D - will jump to file that is included in the current PHP file.
- doc -> Tab - if you type word doc above class/method/function and hit Tab after it, you will get documentation block for the related entity.
- Cmd + Shift + R - will run your file with current system PHP executable. This is very nice when you just test something and want to see the output, but don’t want to get out to shell and command line.
- Alt + F1 - documentation about function signature in the form of tooltip. If you forgot weather $haystack or $needle goes first as the param in the array function this is easy way not to search through extensive documentation.
- Shift + Ctrl + T - if you like to place lot of TODO, FIXME or CHANGED meta information in your comments for later addressing, this will help you find them quickly and navigate through them easily.
Beside these shortcuts there are a lot of snippets triggered by hitting Tab after typing its abbreviation. For example doc_f -> Tab will create new function together with doc block. You can see list of all of them in the mentioned bundle editor in the section for PHP bundle. It is pretty easy as well to create your own specific snippets. Many more general or specific shortcuts can be found online e.g. as printable cheatsheets. Or in TextMate manual. The best way to adopt them is to take them one by one and pay attention to use it regularly, as soon as it is at the back of the brain start with new one until you become TextMate productivity wizard.





















