vimpulse: imap "jk" to ESC

Tim Harper timcharper at gmail.com
Fri Feb 11 18:51:43 CET 2011


On Fri, Feb 11, 2011 at 10:06 AM, Tim Harper <timcharper at gmail.com> wrote:
> On Fri, Feb 11, 2011 at 10:01 AM, Tim Harper <timcharper at gmail.com> wrote:
>> On Thu, Feb 10, 2011 at 11:28 PM, Linus Arver <linusarver at gmail.com> wrote:
>>> Hello, I'd like to know how to map "jk" to act as the ESC key in insert mode.
>>>
>>> I have tried
>>>
>>> (vimpulse-imap "jk" 'viper-intercept-ESC-key)
>>>
>>> without success.
>>>
>>> -Linus
>>
>> Try this:
>>
>>
>> (define-key viper-insert-basic-map (kbd "j k") 'viper-mode)
>>
>
> Nevermind... that's worse :)  It causes j to become a prefix key,
> losing self-insert binding for j + any other key.
>
> It seems like a specialized function will be needed that will capture
> the next key and need to insert a j + resend the other key pressed to
> the unread-command-events... I don't know if such a facility exists in
> vimpulse, but would be easy enough to concoct... I'll post an example
> in a bit
>

This works:

https://gist.github.com/822738

Tim



More information about the implementations-list mailing list