0

I have recently set vim key binding to my zsh terminal on OSX, as described in here.

However, the deault keybindings doesn't have the mapping from jj to insert mode -> normal mode transition.

Howe can I implement this keybinding for my zsh terminal?

Our
  • 186
  • 11
  • 1
    Hi, this is explained far better in the [zsh manual](https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html). This manual will also help you setup keybinds for both command mode (normal mode) and insert mode as well as general keybinds. – SeetheMoar Mar 27 '22 at 18:13
  • @SeetheMoar I didn't even know zsh had a manual. Thanks for pointing out! – Our Mar 27 '22 at 19:03

1 Answers1

1
bindkey -M viins jj vi-cmd-mode

will bind jj to the vi-cmd-mode widget in the viins (vi insert mode) keymap.

Now, you need to type those two js within $KEYTIMEOUT centiseconds (40 by default) of each other. Otherwise, that inserts two js. That also means that when you enter j in insert mode, it won't be displayed until you press another key or you wait for those 0.4 seconds.

Check the manual for details.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501