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?
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 modehttp://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@schito.me (gtalk) ☎ (+39) 348/9051393 perlelia@gmail.com (FaceTime)
On Sat, Aug 11, 2012 at 7:16 PM, Hans Stimer hans.stimer@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.
- 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.
- 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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Elia,
I started using TM1 when it was about a year old, but I had to give up on mouse based editors because of the shoulder pain of always reaching for the mouse. I tried using the meta key combinations as a substitute, but after a year of that my hands really hurt.
Several programmers, told me that they had switched to Vim because of similar reasons and that they had much less pain. With Vim, or ST2/Vintage, I can code all day without problems.
Even though I like Vim, I still feel like it has a lot of flaws and there are times when a mouse is just plain superior no matter how well you know the magic Vim key combinations. When I tried ST2 with the Vintage plugin, it became clear how much better a hybrid editor could be.
Some people feel strongly that modes are very un-mac, which I have to agree with. However, even Apple releases modal software that breaks their UI guidelines, because sometimes modes lead to greater productivity. For instance, Final Cut Pro X is filled with no-meta-key key commands (http://www.premiumbeat.com/blog/the-big-cheat-sheet-of-final-cut-pro-x-short...).
I certainly wouldn't want to turn TM2 into Vim, but I believe that there are good reasons to optionally offer some key Vim functionality within TM2.
I am very productive with ST2/Vintage now days, however I believe in choice and I would like to see 2 very good editors both providing a Vim like option. Also, I have an affection for TextMate since it provided me with years of enjoyable use. Finally, with TM2 being open sourced, I feel that it will be around in 20 years, so that any work I put into it will still benefit me later.
-- Hans Stimer Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Saturday, August 11, 2012 at 10:27 AM, Elia Schito wrote:
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@schito.me (mailto:elia@schito.me) (gtalk) ☎ (+39) 348/9051393 perlelia@gmail.com (mailto:perlelia@gmail.com) (FaceTime) On Sat, Aug 11, 2012 at 7:16 PM, Hans Stimer <hans.stimer@gmail.com (mailto:hans.stimer@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.
- 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@lists.macromates.com (mailto:textmate@lists.macromates.com) http://lists.macromates.com/listinfo/textmate
_______________________________________________ textmate mailing list textmate@lists.macromates.com (mailto:textmate@lists.macromates.com) http://lists.macromates.com/listinfo/textmate
Thank you for the patient answer :) Seem good reasons indeed.
Elia
PS. check out this: https://github.com/alevchuk/vim-clutch#readme
— ☁ @elia http://twitter.com/elia (twitter) ✎ elia@schito.me (gtalk) ☎ (+39) 348/9051393 perlelia@gmail.com (FaceTime)
On Sun, Aug 12, 2012 at 2:29 AM, Hans Stimer hans.stimer@gmail.com wrote:
Elia,
I started using TM1 when it was about a year old, but I had to give up on mouse based editors because of the shoulder pain of always reaching for the mouse. I tried using the meta key combinations as a substitute, but after a year of that my hands really hurt.
Several programmers, told me that they had switched to Vim because of similar reasons and that they had much less pain. With Vim, or ST2/Vintage, I can code all day without problems.
Even though I like Vim, I still feel like it has a lot of flaws and there are times when a mouse is just plain superior no matter how well you know the magic Vim key combinations. When I tried ST2 with the Vintage plugin, it became clear how much better a hybrid editor could be.
Some people feel strongly that modes are very un-mac, which I have to agree with. However, even Apple releases modal software that breaks their UI guidelines, because sometimes modes lead to greater productivity. For instance, Final Cut Pro X is filled with no-meta-key key commands ( http://www.premiumbeat.com/blog/the-big-cheat-sheet-of-final-cut-pro-x-short... ).
I certainly wouldn't want to turn TM2 into Vim, but I believe that there are good reasons to optionally offer some key Vim functionality within TM2.
I am very productive with ST2/Vintage now days, however I believe in choice and I would like to see 2 very good editors both providing a Vim like option. Also, I have an affection for TextMate since it provided me with years of enjoyable use. Finally, with TM2 being open sourced, I feel that it will be around in 20 years, so that any work I put into it will still benefit me later.
-- Hans Stimer Sent with Sparrow http://www.sparrowmailapp.com/?sig
On Saturday, August 11, 2012 at 10:27 AM, Elia Schito wrote:
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 modehttp://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@schito.me (gtalk) ☎ (+39) 348/9051393 perlelia@gmail.com (FaceTime)
On Sat, Aug 11, 2012 at 7:16 PM, Hans Stimer hans.stimer@gmail.comwrote:
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.
- 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.
- 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@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On Aug 11, 2012, at 7:16 PM, Hans Stimer hans.stimer@gmail.com wrote:
- 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.
- 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@lists.macromates.com
Thanks Alan, I'll start by sticking it into keyDown, and we can change it later so that the code can be moved to a plugin.
-- Hans Stimer Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Saturday, August 11, 2012 at 11:29 AM, Allan Odgaard wrote:
On Aug 11, 2012, at 7:16 PM, Hans Stimer <hans.stimer@gmail.com (mailto:hans.stimer@gmail.com)> wrote:
- 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.
- 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@lists.macromates.com (mailto:textmate-dev@lists.macromates.com) _______________________________________________ textmate mailing list textmate@lists.macromates.com (mailto:textmate@lists.macromates.com) http://lists.macromates.com/listinfo/textmate