[TxMt] Re: Hacking Vim mode into TM2
Elia Schito
elia at schito.me
Sat Aug 11 17:27:50 UTC 2012
I think TextMate is wonderful also because it's so integrated with its
platform (OSX).
OSX relies on "meta" keys to perform tasks and on "letter" keys to input
text, which in my opinion is a better paradigm. If you reconsider vim style
from this point of view they're very similar: you hold some non-text key
instead of hitting ESC+:.
Also most of TM shortcuts work across the whole system (I always hated when
after using vim you start typing random letters in the textfields of all
you're other programs).
So I think integrating vim paradigm is a bad idea, though as a plugin seems
more harmless.
Remember that, besides vim and macvim you have sublime text vintage
mode<http://www.sublimetext.com/docs/2/vintage.html> which
probably does everything you're asking for. That said I strongly recommend
you to stay on TM and maybe go deeper in bundles stuff (after years using
it they still make me smile).
Elia
PS. I know to be a bit biased against vim, please forgive me if I've been
rough :)
—
☁ @elia <http://twitter.com/elia> (twitter) ✎ elia at schito.me (gtalk)
☎ (+39) 348/9051393 perlelia at gmail.com (FaceTime)
On Sat, Aug 11, 2012 at 7:16 PM, Hans Stimer <hans.stimer at gmail.com> wrote:
> I'm looking for advice on the best way to hack minimal Vim support into
> TM2. I'm not looking to support all of Vim, but just a subset of what might
> be referred to as Vim normal mode.
>
> Desired behavior
> ===
> Until Vim mode is activated, TM2 should behave as normal. Once activated,
> all the <meta>*-<key> combinations will continue to work as normal TM2
> commands, but non-meta key combinations will be interpreted as Vim
> commands.
>
> Entering Vim normal mode
> ---
> Traditionally, Vim normal mode is entered via hitting the escape key.
> Since most people won't want Vim behavior, there needs to be a toggle that
> enables Vim so that the escape key will work. This prevents existing TM2
> escape behavior changing for those who don't want the optional Vim behavior.
>
> Additionally, it is not uncommon for Vim users to remap the Vim normal
> mode entry trigger to something like "jj". This should be supported so that
> users can have the escape key retain it's traditional TM2 use.
>
> Vim normal mode
> ---
> I would like to support the full range of Vim commands for motion,
> deleting, and changing of text short of entering command mode i.e.
> ":<command>"
>
> Vim command mode
> ---
> No support, but maybe a subset later.
>
> Vim search mode
> ---
> I don't think this needs support, however it would be handy for '/' to map
> to opening the find dialog.
>
>
> Approaches
> ===
> I've spent a little time trying to figure out how to modify TM2 for Vim
> support and I'm not sure which direction I should go.
>
> 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.
>
> 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?
>
> Thoughts?
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20120811/6dc8aef2/attachment.html>
More information about the textmate
mailing list