[TxMt Plugins] Re: tracking the filename of the currently selected tab
Niko Matsakis
niko at alum.mit.edu
Fri Jan 29 09:42:56 UTC 2010
>> I would like to write a TextMate plugin which creates a window containing a txt2tags [1] rendered version of the file I am currently editing. (Actually a somewhat modified version of txt2tags)
>
> I assume you are aware of the WebPreview and its ability to have a command configured that filters the currnet text!?!
Yes, it doesn't quite do what I want... but thanks to both of you for pointing it out. In particular, WebPreview doesn't track the current file, as far as I know. I would also prefer it if the preview window were not separate but rather integrated into the Project editing window, probably with a slider to adjust the real estate used for editing / viewing the transformed version.
>> As I navigate through different files, I'd like this window to update to reflect the current file.
>>
>> I feel like there is probably a fairly simple way for me to observe the file currently being actively edited, but after spending some time browsing through the methods and fields of OakTextView, OakTabBarView, etc, I haven't found out what it is.
>>
>> Any advice? Pointers to similar projects?
>
> If you want this to (potentially) also work for 2.0 then you should monitor the NSWindow’s representedFile property. This can be done via bindings or method swizzling.
Great, that's exactly what I was looking for!
thanks,
Niko
More information about the textmate-plugins
mailing list