Multi-Line Match

TextMate uses the (?m:<regex>) in order to math the regex regex as multi-line. For example, in order to match everything between and including the tags <p> and </p>, you would search:


As an example, the above regex will match the following input:


Hard-Wrap Lines

The Macromates-TextMate blog presents a script how to hard-wrap lines using a simple regular expression. In order to add this feature to TextMate, open TextMate and select the menus Bundles→Bundle Editor→Edit Commands… and then press the plus sign (+) to create a new command:

The script that must be entered should be:

#!/usr/bin/env ruby
# Wraps selected text to 76
def wrap_text(txt, col = 76)
  txt.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/,
STDOUT.sync = true
print wrap_text(ENV['TM_SELECTED_TEXT'])

Compatibility with GPG Tools

If you have used a recent version of TextMate, you will notice that GPG Tools do not play well with it and that if select some text, then go to services, you will not find an option to encrypt or decrypt text. The problem lies with GPG Tools, in the file located at /Library/Services/GPGServices.service/Contents/Info.plist. GPG Tools bundles a fixed list of utilities by the bundle identifier for which certain actions such as encrypt or decrypt are available. Unfortunately, GPG Tools defines a bundle identifier of com.macromates.TextMate.preview for TextMate and the TextMate bundle identifies itself as com.macromates.textmate.

Changing the Info.plist on GPG Tools does not work because GPG Tools performs some checking on the files to determine if they have been tampered with. Instead, we can change the TextMate bundle identifier by editing the file at /Applications/ Change the line reading:

    CFBundleIdentifier            = "com.macromates.textmate"; 


    CFBundleIdentifier            = "com.macromates.TextMate.preview"; 

and then restart TextMate. On the next run, the GPG Tools will offer their services.

Use Soft Tabs (Spaces Instead of Tabs) by Default

Create the file ~/.tm_properties and add softTabs = true. The following line executed as the current user will append softTabs = true to ~/.tm_properties:

echo 'softTabs = true' >> ~/.tm_properties

You can also add tabSize = 4 to ~/.tm_properties in order to use 4 tabs by default.

fuss/textmate.txt · Last modified: 2017/04/21 15:28 by office

Access website using Tor Access website using i2p

For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.