On Wed, Aug 19, 2009 at 3:38 AM, Jean-Philippe Bernardy<jeanphilippe.berna...@gmail.com> wrote:
> I'm going to explain the idea of how this works, so other people can > fix details like this. > Consider Yi.Keymap.extractTopKeymap. It constructs the keymap that's > actually going to be > used. Notice that it runs startKeymap once and then repeats the topKeymap. > Each mode can modify the KeymapSet. In particular, the minibuffer mode > (what you call cmd mode) > uses "insertKeymap" for topKeymap. (check spawnMinibufferE). > > So the issue you observe is because the startKeymap for vim always > sets "insert" to false. So one > way of fixing it would be two "startKeymaps", one for insert, one for global. > Would you like to give it a shot? I really appreciate your explanation, and it helps me understand the situation much better. When I finally get a free moment, which may be several days, I'll attempt this; at the moment, I'm lucky to even be responding to emails. :) > Now, I need to explain why there must not be any action written in a > repeatable part of the keymap. > (ie. why you can't put the setInsert False at the beginning of the > toplevel keymap). The reason is because > those keymaps are often modified by modes (or the user) by disjunction > with some thing else. Then you get > a keymap like this: > > (someEvent >> userAction) <|> (write (setInsert False >> > someOtherEvent >> stdAction) > > The situation is that the keymap interpreter does not know whether to > write "setInsert False" until > it can choose which branch to take. So effectively it is delayed by 1 > event. (On top of that, if the user > branch is taken, setInsert will never be written) That actually makes a lot of sense, and I hadn't considered this when I first wrote the keymap. It therefore makes a lot of sense that setInsert would never be called in the minibuffer mode. > It is a little annoying. Whenever a new buffer is created the start > actions have to be pulled out of the > keymap and ran. Without looking more closely, I don't immediately see how this relates to the first explanation, but I expect it'll become clear once I play with it a little more. > Wishing you the best in your new city, Thanks! Jeff Wheeler --~--~---------~--~----~------------~-------~--~----~ Yi development mailing list yi-devel@googlegroups.com http://groups.google.com/group/yi-devel -~----------~----~----~----~------~----~------~--~---