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?

  • 1
    Hi, this is explained far better in the zsh manual. 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, 2022 at 18:13
  • @SeetheMoar I didn't even know zsh had a manual. Thanks for pointing out!
    – Our
    Mar 27, 2022 at 19:03

1 Answer 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .