no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Previous revision
fuss:textmate [2022/04/19 08:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== 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:
 +
 +<code>
 +(?m:<p>.+?</p>)
 +</code>
 +
 +As an example, the above regex will match the following input:
 +<code html>
 +<p>
 +  Good
 +  Day!
 +</p>
 +</code>
 +
 +====== Hard-Wrap Lines ======
 +
 +The [[http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/|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:
 +
 +{{fuss:fuss_textmate_wrap_76.png?512}}
 +
 +The script that must be entered should be:
 +<code ruby>
 +#!/usr/bin/env ruby
 +# Wraps selected text to 76
 +
 +def wrap_text(txt, col = 76)
 +  txt.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/,
 +    "\\1\\3\n")
 +end
 +
 +STDOUT.sync = true
 +print wrap_text(ENV['TM_SELECTED_TEXT'])
 +</code>
 +
 +====== 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/TextMate.app/Contents/Info.plist''. Change the line reading:
 +<code>
 +    CFBundleIdentifier            = "com.macromates.textmate"; 
 +</code>
 +
 +into:
 +<code>
 +    CFBundleIdentifier            = "com.macromates.TextMate.preview"; 
 +</code>
 +
 +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'':
 +<code bash>
 +echo 'softTabs = true' >> ~/.tm_properties
 +</code>
 +
 +You can also add ''tabSize = 4'' to ''~/.tm_properties'' in order to use 4 tabs by default.

fuss/textmate.txt · Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


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