When typing a complicated command that started on the command line in Bash, how do I switch to editing it with ViM?
Asked
Active
Viewed 1,289 times
2 Answers
7
There is a readline command, called edit-and-execute-command tied to the sequence C-x C-e, that invokes your editor with the current content of the command line for editing.
When you exit the editor the command is executed.
enzotib
- 51,661
1
I'm not sure you can do so in the middle of typing in the command, but you (at least in my experience) can switch to an 'emacs' or a 'vi' line-editing mode via set -o emacs or set -o vi respectively. Those commands will set keybindings for things like last-command, erase-word, erase-to-end-of-line, erase-to-start-of-line, etc.
John
- 17,011
set -o vi, you want to hitEscv– glenn jackman Aug 06 '13 at 19:26