See WordPress Coding Standards under “Space Usage” for details.
#Textmate command line code#
Here’s what the bundle editor window should look like for this command:įollow the same steps as above, but use the following code instead in the “Command(s)” field, and change the command title to “Change Spaces to Tabs.”
Leave the other settings as they are, and save the command. If you want to map the command to a keyboard shortcut, find the “Activation” menu, click the input area, and enter the keyboard shortcut. Name it “Remove Trailing Spaces in Document / Selection” and paste the following code into the “Command(s)” field. Select your bundle and use the “New” menu at the bottom left of the bundle editor to add a new command. “Remove Trailing Spaces in Document / Selection” Command
I usually add my own commands to a bundle called so it sticks to the top of my bundle list.
#Textmate command line how to#
If you don’t know how to add commands to a TextMate bundle, or don’t have your own bundle set up yet, start here and add a new bundle. In this post I’ll show you how to add two useful commands to TextMate, then move through the steps I take for theme code cleanup and put the commands into practice.įirst, let’s add the commands to a TextMate bundle. During the code cleanup I often perform certain cleanup tasks over and over, which makes them perfect for TextMate commands. If you do not plan to use crontab (which I guess is obsolete now that we have launchd), you can ignore all this.I spend a lot of time cleaning up WordPress themes. When the shell command is called with that suffix, it will automatically set the -w flag. It is crontab, and in this case you can either do a wrapper (script) for mate which adds the -w argument (that is what the previously included tm_wait script did), or you can create another symbolic link to the mate executable, which has _wait as suffix, e.g.: ln -s mate ~/bin/mate_wait There is one command though, which doesn’t support that. One purpose of the mate command is so that you can use TextMate as your editor for Subversion commit messages and similar (for the few times you do not commit from within TextMate :) ), for this to work, mate should be called with the -w option, and for most applications you can include that in the EDITOR variable, e.g.: export EDITOR="$HOME/bin/mate -w" It is important that you use $HOME instead of ~, since the tilde is not expanded inside strings (the line should be placed in e.g. On the subject of the mate shell command, setting your path to include ~/bin needs (for bash) to be done like this: export PATH="$HOME/bin:$PATH"
I plan to allow TextMate to create this symbolic link for you, just need to figure out the best way to do so. Since this only creates a symbolic link, updating TextMate in the future should keep the shell command up-to-date as well. So assuming you installed TextMate under /Applications and you want the mate command in ~/bin, you would (from Terminal) run: ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate What you are supposed to do is, create a symbolic link from your bin directory to the shell command inside the application bundle. The command is now located in the actual TextMate application bundle (under Contents/Resources), and is named mate (since some mistyped tm and got rm instead).
#Textmate command line update#
Included with previous versions of TextMate was a shell command named tm which is absent from the recent update (for those who don’t read the release notes). Next post: Release 540 was Tiger only TextMate shell utility (tm/mate)