Consider, with Input = Selected text or Line,
#!/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 \ and I am not surprised. But what is the cleanest way to get back the original line unchanged? I can manage the slashes but not the dollar. And e_sh is not a solution since it adds spurious slashes which I have to take care of.
Thanks, Piero
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
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