tags:

views:

762

answers:

5

This isn't specifically a general programming question but a lot of textmate users I know end up building a textmate command to do something they often do but as it's on it's own never really release it. Mines Below:

Objective-C Build and Run

For when I'm just quickly writing a small Objective-C command line program, place this in a new command; set input to entire document, output as HTML and set the activation as you want it (I use [apple] + [shift] + R).

gcc "$TM_FILEPATH" -o "$TM_DIRECTORY"tmpTextMateRunObjectiveC -l objc
"$TM_DIRECTORY"tmpTextMateRunObjectiveC
rm "$TM_DIRECTORY"tmpTextMateRunObjectiveC
+2  A: 

The only real TextMate enhancement I use (other than language bundles) the ProjectPlus plug-in. It replaces the annoying project drawer with a project panel, adds support for SVN, Git, Mercurial, Bazaar and Svk, and adds lots of other small stuff.

Here's the feature list from the project page:

  • SCM status badges:

    • Support for SVN, Git, Mercurial, Bazaar and Svk
    • Displayed in the project file list and the window proxy icon
  • Swapping the project drawer for a panel

    • Support for ⌃⌥⌘D and ⌃⌘R is kept
    • The sidebar can be placed on either side of the window
    • Since I created this someone has updated the MissingDrawer plug-in with these features, if you wish to use this plug-in instead then you can disable the feature
  • Finder colour labels

    • Labelled files are displayed in the project drawer
    • Label can be set through the context menu
  • Project-tree state can be preserved when re-opening the project
  • QuickLook preview of files in the project file list through the context menu (or ⌥␣ when the file list is focused)
  • Sorting options through the project file list context menu
  • Display folders on top
  • Sort by file extension
  • “Open With” option
dlfnation
A: 

I have a bunch of snippets/commands/macros I've made but they are mostly language specific, and to a certain degree Martin-specific. What I do a whole lot of though is to program the rest of the OS to work nicely with TextMate, usually through QuickSilver (or sometimes when I can't get QS to do the job; QuicKeys).

Opening the "View Source" window in Firefox in TextMate is just a google search away, and in this post (by me) there's a few AppleScripts that comes in handy. Of course, you should install the "Edit in TextMate" plug that'll let you edit any textfield in any Cocoa app in TM, save it and get on with it.

To answer your actual question though, I feel that for the most part people are extremely generous about sharing what they find might be of public interest, while for the most part TextMate tends to become a very personal tool that grows with its user. Meaning; If I sent you the commands and snippets I haven't already shared publically you probably wouldn't like them.

Martin
+1  A: 

A nice blog post on how Alex Payne uses TextMate. I highly recommend using the GetBundles bundle, to manage, and update your bundles in TextMate. Very nice for browsing for new bundles, and updates to existing ones.

program247365
A: 

I generally find myself just adding my own custom language snippets. I haven't even yet figured out how to edit the syntax coloring or other more complex things in Textmate. I haven't found myself needing to know how to do those things either. I do use ProjectPlus though but mainly the ability to add my own snippets is 90% of what makes me love Textmate.

Martin, I'd love to hear about some of these things you do with Quicksilver and Textmate as Quicksilver is another app that I want to learn to "abuse and overuse".

Pselus
A: 

Modify Syntax Highlighting (e.g., teach TextMate new keywords in your language of choice).

For example, to cause TM to highlight 'eval' and 'compile' in Python:

(i) select 'Bundles' > 'Bundle Editor > 'Edit Languages';

(ii) choose 'Python' from the Bundles on the LHS of the Bundle Editor;

(iii) click on 'Python' so that you see the drop-down choices (preceded by 'L');

(iv) click the choice 'Python';

(v) make sure 'Editing' is toggled in the upper right-hand-cornder of the B/E;

(vi) on the RHS, you'll see the entire grammar for the selected language;

(vii) scroll down about 100 lines, until you see, 'comment = "keywords that haven't fit into other groups (yet).";

(viii) a number of language Bundles have this category and many of the changes you'll want to make will likely belong here;

(ix) now go to the next line (begins w/ 'match') and add a pipe character ('|') after the last item before the ')\b', then type 'exec', followed by another '|' then type 'compile'--that's it.

Now TM will recognize these two words, but as what? I.e., how does it color them?
In this instance, we told TM they were keywords, so go to TextMate > Preferences > Fonts & Colors, and scroll down until you find the 'Comment' in the Element field. There you'll see it's color, but that's just a function of the Theme you're using at the moment.

In sum, you can change both which words TM recognizes (via the relevant language grammar) and how TM colors that word via the Fonts & Colors tab, which again is Theme-dependent.

And Now For Something Completely Different: if you get tired of purple, check out the alternative GUIs, which (takes about 2 minutes or less to DL and install): http://wiki.macromates.com/Main/AlternativeGUIs. The last one called 'Green Moleskine' by Jason Evers is the only one i've used. Gorgeous as you can see, plus takes like 2 min to DL and install.

doug