Question abount binding a key(sequence) for editline(7)

In vim(1) I have a binding that makes 'jk' act like the ESC (in order to set visual mode). I want to set up this binding for the sh(1) command line editor, editline(7), which can act in the vi-mode as well. The 'bind' command is documented in editrc(5) and the editor commands are documented in editline(7).

So, I tried to accomplish this via both regular binding and with the macro:

1) Regular binding:
Code:
bind "jk" vi-command-mode

Well, it sort of works: when I type 'jk' in the insert mode, the mode is changed into the visual (command) mode. But now it is impossible to type (insert) the 'j' character whatsoever. It now waits until it receives the next character and doesn't print 'j'.

2) Macro:
Code:
bind -s jk ^[

The result is the same as this of the regular binding.

I also tried to find a 'workaround' for this, like:
Code:
bind "jk" vi-command-mode
bind "j" ed-insert
But nope: the last binding overrides the previous one and now 'jk' doesn't switch the editor into the command mode.

Did anyone try to do something similar? Is it even possible?
 
Back
Top