[TxMt] Re: Escaping a selection

Allan Odgaard mailinglist at textmate.org
Wed Apr 8 19:22:54 UTC 2009


On 26 Mar 2009, at 12:38, Scott Haneda wrote:

> How can I escape certain chars in a selection in TM?  If this is not
> built in, can someone help me make a macro or equivalent to do so?

If you want to escape " and \ then the steps to record a macro would be:

  1. Start Macro Recording
  2. Bring up the Find dialog
  3. Use ‘[\\"]’ as find string and ‘\\$0’ as replace string
  4. Enable “Regular Expression”
  5. Hold option (⌥) and hit “Replace All”
  6. Stop Macro Recording

Now save that and give it a key equivalent, possibly also scope it to  
“source.php” (which is where I assume you want to use this).

Alternatively uou can make a command that takes e.g. “selection or  
line” as input and replaces selection and the actual command being a  
simple ruby/perl/sed substitution.




More information about the textmate mailing list