[TxMt] Re: Hacking Vim mode into TM2
mailinglist at textmate.org
Sat Aug 11 18:29:48 UTC 2012
On Aug 11, 2012, at 7:16 PM, Hans Stimer <hans.stimer at gmail.com> wrote:
> 1) Hard code it right into TM2. It looks like I could start with OakTextView:keydown and branch off to a Vim interpreter if Vim is enabled. I think this is probably the easiest and most flexible approach.
This is how I’d approach it.
The keyDown is already multiplexing between normal mode, and snippet pop-up menu mode. It might be good to refactor that a bit so we can register event handlers at run-time, that would allow moving the vim code to a plug-in.
But without knowing exactly what you’d need from TM, easier to just start with hardcoding things in keyDown.
> 2) Create a TM2 plugin/bundle that does most of the work, and modify TM2 just enough to provide the support that such a plugin/bundle would need. This approach worries, me because I'm not sure how much modification TM2 would need to expose all the required interface to the plugin system. Do TM2 plugins work the same as TM1 plugins? Is the TM2 plugin API in flux?
They work the same, and there really isn’t any plug-in API other than the public Cocoa protocols that some of the classes implement, e.g. OakTextView conforms to NSResponder (which I assume have most of the methods you’d need to call from your vim mode).
P.S. I think it’s better to move discussions about the TM source to textmate-dev at lists.macromates.com
More information about the textmate