On Mon, Jun 8, 2020 at 3:30 PM Chet Ramey <[email protected]> wrote: > > ................ > On 6/8/20 12:46 AM, Leo Alekseyev wrote: > > > set keymap vi-insert > > "\e.":yank-last-arg > > Even with those first two changes, which will be in the next bash devel > branch push, you'll have to be very careful with this. This key binding > introduces ambiguity: either you want to run the function bound to ESC, > which puts you into vi command mode, or you want to run yank-last-arg or > any other function with an ESC meta prefix. Readline has to read an > additional character to disambiguate, and it needs to read it with a half > second or so to be part of the key sequence (this is the standard readline > way to tell the difference between ambiguous prefixes). If you take longer > than a half second, you might find yourself running the `.' (redo) command.
Thank you for fixing this bug. Regarding the ambiguity, it is my assumption that the intended use of bindings like "\e." in vi mode is to enable alt/meta chords, i.e. the user would never actually want to press "ESC ." to invoke the yank-last-arg or whatever else function. With this in mind, as it stands, "M-." would invoke yank-last-arg immediately (with the above binding), while "ESC ." would invoke the redo command (with the 500 ms timeout after ESC). Empirically, the 500 ms ESC timeout does not result in usability issues. So it seems that such bindings while technically ambiguous are not problematic given the intended use case; correct me if I'm wrong on this.
