The answer
Press ESC to go into vi-command mode, then press v. Bash will start your your chosen $EDITOR. If you haven't chosen one, Bash will start vi (the visual editor).
Explanation
Why does Bash's ESCv start vi?
Because Bash's bashline.c
includes the function call:
rl_bind_key_if_unbound_in_map ('v', vi_edit_and_execute_command, vi_movement_keymap);
What is vi_edit_and_execute_command
? It's a Bash C function, defined elsewhere in bashline.c
.
One aside. I have experimented a bit, and the following is what I now suspect is true. Binding Bash C functions is weird. You can do it from within Bash's source code, but it seems impossible to do so by using the bind
builtin at the Bash prompt. And, once you've done it, the bind
builtin doesn't seem to even recognize that it's been done.
I thank Glenn Jackman for pointing out that ESCv is the answer, and dualbus and Riviera of Freenode #bash for helping me to figure out the explanation above.