[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash readline remap ESC insert/command mode key

From: Roger
Subject: Re: Bash readline remap ESC insert/command mode key
Date: Wed, 18 Jan 2012 22:25:42 -0900
User-agent: Mutt/1.5.21 (2010-09-15)

>bind -m vi-command '"ii": vi-insertion-mode'
>bind -m vi-insert '"ii": vi-movement-mode'
>Or the following should work (untested here) using $HOME/.inputrc:
>$if mode=vi
>    set keymap vi-command
>    "ii": vi-insertion-mode
>    set keymap vi-insert
>    "ii": vi-movement-mode

I've just tested the above inputrc by executing a new bash shell instance and 
the above inputrc statement works, but there is an undesirable effect when 
using it.

While in insert mode, pressing the 'i' key only once causes readline to 
intercept it and not print the 'i' char to screen if only pressed once.  In 
order to get the 'i' char printed, I need to immediately press any other key 
following the 'i' char/key so it is not intercepted by readline as it is not a 
double 'i' key (ie 'ii').

For example, I'm typing the imaginary command "sit" and accidently typed "st".  
I go to history and then movement mode and try to insert just an 'i' and will 
fail as readline is intercepting the single char and awaiting a secondary char 
to determine if it's a double 'i' key press.  I would need to type 'i' and then 
right cursor to successfully fix the typing error.

(Or, to be lazy and humorous, I could just fix it to 'silt' preventing less 
finger movement.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]