Invoking external editor from Vi command line editing mode in zsh

command lineoh-my-zshvivimzsh

For some reason, I can't get the keybinding to invoke Vim (my editor) to work with Esc+v zsh when using iTerm.

I've gone back to a minimalist .zshrc file, to ensure it's not a plugin issue:

# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:/Users/user/go/bin:$PATH

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/kubebuilder/bin

export EDITOR="/usr/bin/vi"

# Path to your oh-my-zsh installation.
export ZSH="/Users/user/.oh-my-zsh"

ZSH_THEME="gnzh"

source $ZSH/oh-my-zsh.sh

set -o vi

But when on the command line, I can't seem to use Esc+v to open the editor and I'm not sure why.

If I change my shell to bash, it works fine so it seems to be an issue with zsh.

Have also tried bindkey -v to no avail.

Best Answer

Directly copy-pasted from the zshcontrib(1) manpage (or info zsh edit-command-line):

autoload edit-command-line
zle -N edit-command-line
bindkey -M vicmd v edit-command-line
Related Question