Ctrl-x Ctrl-e

TIL you can edit complex CLI commands using vi by pressing Ctrl-x Ctrl-e in your terminal. This operation opens the current command in your default editor (usually vi or nano). complex CLI command Editing CLI command in vi

fc command

TIL you can edit CLI’s commands history in vi/vim mode using fc command.

# To edit last command history
fc
# To show command history and the command id
fc -l
# To select a command using command id
fc <command id>