For the env below:
System: mac
Terminal : iterm2
shell: zsh
Then you can edit the shell like vi mode:
# bind therminal to vim mode
bindkey -v
# and some key map in vim mode
# bindkey '^P' up-history
# bindkey '^N' down-history
# bindkey '^?' backward-delete-char
bindkey '^h' backward-word
bindkey '^l' forward-word
bindkey '^j' backward-char
bindkey '^k' forward-char
bindkey '^m' kill-word
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward
# set the delay time
export KEYTIMEOUT=1
And if you don't know how many keymaps the bindkey have, you can use execute: in the shell terminal(just press ":"), then <tab><tab>, you will get all of the functions where keybind can set