ZSH has a built-in function called edit-command-line
which allows you to edit the current command with an external editor (defined by the environment variable $EDITOR
). To enable this feature, add the following to your ZSH startup scripts:1
2
3
4
autoload edit-command-line
zle -N edit-command-line
bindkey '^Xe' edit-command-line
For the interested, this article lists some useful keyboard shortcuts in ZSH.