Vim2 example config is here: https://github.com/yi-editor/yi/blob/master/yi/example-configs/yi-vim2.hs
Following the pattern there you could add imap "jk" (eval "<Esc>l") to myBindings list, but there is one problem: yi-vim2 binding matcher is greedy and when user inputs "jk" it will always choose to print "j" immediately when it's entered. Real vim (and other keymaps in yi, I suppose) instead would wait for some time to see if user inputs "k" after "j" to resolve the ambiguity. I made vim2 behave that way just out of personal preference. If you feel strongly that greedy input matcher is evil, please make an issue on github, maybe we will be able to make this greediness optional so that everyone will be happy. The only thing I can offer you right now is to make it a habit to press <C-[> instead of <Esc>. It took me a day to relearn and I don't regret it. On Tue, Feb 11, 2014 at 2:16 AM, fa-ml <[email protected]> wrote: > Good evening, > > I recently installed (compiled from git) Yi. I am a vim user, > so I decided to translate some basic functions from my .vimrc to my > yi.hs config file. > > I decided to start with something simple: > > " quick remap to esc (don't slide right while doing it) > :inoremap jk <Esc>l > :cnoremap jk <Esc>l > > For the vim-impaired users, this means "pressing 'jk' will exit insert > mode" (more precisely, 'jk' will be substituted with <Esc> key). > > IRC user <Fuuzetsu> kindly pointed me to some example yi.hs > configuration files, and I tried to work from those to a working code. > Alas, I did not succeed. What I have is: > > modKeymap ∷ KeymapSet > modKeymap = mkKeymap $ override defKeymap $ λsuper self → > super { v_top_level = (v_top_level super) ||> > (char 'j' ?>> char 'k' ?>>! clrStatus) > } > > I don't know what to substitute the placeholder clrStatus with. In > Yi.Keymap.Vim there is a |leaveInsRep| function [1], but it is of a far > different type than the expected type. > > I am blocked here: I tried to check Vim2 to see if I found that more > palatable, but the lack of example config files made it look a daunting > task. > > Any direction is welcome, I attach my complete yi.hs > -F > > > [1] > https://github.com/yi-editor/yi/blob/015949bee9ac5b5f2e885cd4b7af2fb07e87aea8/yi/src/library/Yi/Keymap/Vim.hs#L1589 > -- -- Yi development mailing list [email protected] http://groups.google.com/group/yi-devel --- You received this message because you are subscribed to the Google Groups "yi.devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
