[TxMt] Combining snippets and commands?
Dr. Drang
drdrang at gmail.com
Tue Feb 28 16:42:22 UTC 2006
On Feb 28, 2006, at 8:54 AM, Fred B. wrote:
> Following your questions on the list and the answers to it, I did
> the same yesterday, but with Ruby.
>
> The only difference is that it increments the last id number and
> insert it instead of "id". That may interest you.
Clever! And if I'm reading your code correctly, you're updating from
the last number but still allowing the user to override, which is nice.
> #!/usr/bin/env ruby
>
> str = STDIN.read
> n = str.scan( %r{.*\[(\d+)\]: }m ).to_s.to_i + 1
> print "[${1:description}][${2:#{n}}]$0" + str.gsub(/[$`\\]/, '\\\\
> \1') + "[${2:#{n}}]: ${3:http://}\n"
--
Dr. Drang
More information about the textmate
mailing list