[TxMt] Inserting a File Path

Allan Odgaard allan at macromates.com
Wed Feb 9 19:31:17 UTC 2005

On Feb 9, 2005, at 6:26, Paul McCann wrote:

> Is there an easy way to insert a file/directory path into a TextMate 
> window?

You could make a drag command that does this. Although this wasn't the 
intent of the system. Basically (to also address Eric's recent letter 
;) ) a drag command is a normal command executed when a file is dropped 
on TextMate (I do consider changing this to just a new activation 

A drag command is chosen based on (current) document extension and file 
extension (of dropped file), so you can't make a catch all, and 
currently the document extension is not exposed in the bundle editor, 
because I want to use the (forthcoming) scope system instead.

You can check qualifiers in the command, these are in the 
TM_MODIFIER_FLAGS variable (and can be any combination of: 
SHIFT|CONTROL|OPTION|COMMAND). But there is no way to pass on handling 
of the drop when the drag command has been chosen.

So basically, you can use this, but you'll lose the default behavior 
for drops, and you'll have to specify all the file types you want to 
handle. There are more details about variables and property list keys 
in the release notes.

Drag commands were introduced to handle the case where binary files 
(like images) where dropped onto documents, and a command could 
generate the proper thing to insert (like an <img> tag with 
dimensions). In their current iteration I'm not to fond of them, 
because they are sort of limited.

Adding that TextMate just inserts the filename dropped when holding 
down a qualifier sounds like something that I could just do as a 
built-in function.

More information about the textmate mailing list