[TxMt] Re: Let me escape

Hans-Jörg Bibiko bibiko at eva.mpg.de
Fri Oct 17 18:13:10 UTC 2008


On 17.10.2008, at 19:50, Piero D'Ancona wrote:
> #!/usr/bin/env ruby
> require ENV["TM_SUPPORT_PATH"] + "/lib/exit_codes.rb"
> TextMate.exit_insert_snippet ENV["TM_CURRENT_LINE"]
>
> This changes
>  asd $ \\
> into
>  asd  \
>
> PS what I need is a way to pass to TextMate.exit_insert_snippet
> a string containing dollars slashes etc in such a way that the
> strings is inserted without any change. I know someone can do
> this

Yes. TextMate can do this ;)
use
require ENV["TM_SUPPORT_PATH"] + "/lib/escape.rb"

method e_sn

or

str.to_s.gsub(/(?=[$`\\}])/, '\\')

Ciao,

--Hans




More information about the textmate mailing list