Problem with Ctrl-Left/Right bindings in oh-the-zsh

zsh

For some reason I am unable to bind Ctrl-Left Arrow and Ctrl-Right Arrow to move between words in ZSH after installing oh-my-zsh on my MacBook Pro.

In iTerm2 I have my keybindings configured to "Send Escape Sequence" [1;5D and [1;5C, which worked before installing oh-my-zsh.

I also tried uncommenting

bindkey '^[^[[C' emacs-forward-word
bindkey '^[^[[D' emacs-backward-word

in ~/.oh-my-zsh/lib/key-bindings.zsh, also to no avail. In both scenarios, hitting Ctrl-Left/Right just sends "5D" and "5C" to the screen.

TLDR: Has anyone gotten Ctrl-Left and Ctrl-Right to move between words when using oh-my-zsh?

Best Answer

Change your bindkey lines to:

bindkey '^[[1;5C' emacs-forward-word
bindkey '^[[1;5D' emacs-backward-word
Related Question