[TxMt] drag commands

marios tmtxpstuff at consking.com
Wed Aug 9 15:02:58 UTC 2006


Torsten Becker wrote:
> marios wrote:
>> I have the following drag command for zip files to be inserted as
>> snippet:
>>
>> echo -n  "<a href=\"http://$TM_REMOTE_URL/file_download/\${1:file_id}\"
>> title=\"\${2:"$TM_DROPPED_FILE"}\">\${3:"$TM_DROPPED_FILE"}</a>"
>>
>> This will insert a download snippet for a default URL on a live server.
>>
>> However, I would like to strip the path somehow from the variable.
>>
>>
>> Does anyone know how to do this,through a substitution reg ex maybe ?
>
> ruby can do this for you:
>
> echo -n "<a href=\"http://$TM_REMOTE_URL/file_download/\${1:file_id}\"
> title=\"\${2:`ruby -e 'print
> ENV['\''TM_DROPPED_FILE'\''].gsub(/^(.*\/)/,
> String.new)'`}\">\${3:\$2}</a>"
>
I tried the above, but String.new outputs nil instead. (My SupportFolder
is updated through subversion)

regards, marios




More information about the textmate mailing list