[TxMt] drag commands

Allan Odgaard throw-away-1 at macromates.com
Mon Oct 2 02:11:06 UTC 2006


On 1/10/2006, at 14:26, marios wrote:

> [...] When I use option, and drag the File, The document window  
> looses focus and disappears under the cursor, when the file gets  
> dropped in the document window, so I changed the whole thing to use  
> Shift instead, where I get the expected behavior.

What’s happening here is, that if you ⌥-click another application,  
your active application will hide. So you need to first drag the  
icon, then press ⌥.

> [...] This is the output that I have using the above modification.
>
> <a href="http://www.consking.com/file_download/file_id"
> title="test.abc">test.abc</a>
> <a href="http://www.local.dev/file_download/file_id"
> title="test.abc">test.abc</a>
>
> What I am trying to achieve is this:
>
> <a href="http://www.consking.com/file_download/file_id"
> title="test">test</a>
> <a href="http://www.local.dev/file_download/file_id"  
> title="test">test</a>
>
> ,where test is a transformation of $TM_DROPPED_FILE getting  
> stripped off
> both the relative path AND the file extension .abc
>
> I had a look also, at
> http://macromates.com/blog/archives/2005/09/26/shell-variables/,
> Is there a shorthand way, also to strip both, at the end and the
> beginning, using this method ?

The easiest is to use the regexp substitution capabilities of  
TextMate snippets.

So use something like ${TM_DROPPED_FILE/.*\/|\..+//g} — that ought  
to strip both the leading directories and the trailing extension.






More information about the textmate mailing list