[TxMt Plugins] Re: tracking the filename of the currently selected tab

Niko Matsakis niko at alum.mit.edu
Thu Jan 28 22:13:13 UTC 2010


> maybe try the obvious, get the env var $TM_FILEPATH

*blush* Yes, that does make sense, thanks.  However, I do have a few more questions:

Clearly, I can use this at the time when a bundle command is executed to find out the current file, but can I use TM_FILEPATH to track the current file?  I'd like to know when the user navigates to a new file, whether that's through Command-T, selecting a file from the drawer, switching tabs, etc.  I could imagine perhaps observing changes in various state to know when a change has occurred and then re-reading the environment variable, but I'm not sure if the environment variable is kept up to date.

Also, can environment variables be read by plugins or only from scripts executed as bundle commands? (Not that I have to use a plugin, I'd be just as happy to use a bundle by itself if I thought I could achieve what I wanted that way)


regards,
Niko


More information about the textmate-plugins mailing list