How would I map jj
to Esc
in zsh?
I'm trying to recreate a key-mapping that I have setup in vim, where I have jj
mapped to ESC
so that whenever I double-press j
, it sends the an <Esc>
to vim–allowing me to enter normal mode with greater convenience.
I've already tried bindkey 'jj' ^[
, and I'm about to try bindkey 'jj' ^[[
, but I doubt that it'll work. I also checked the list of commands provided by zsh in normal mode, but I didn't see anything that contained normal
or escape
.
NOTE
The ^[
characters in my ~/.zshrc
file are actual hard coded escapes; not just the characters ^
and [
.
Best Answer
You need
-s
to bind actual strings instead of widgets:Though you probably want to map
jj
to thevi-cmd-mode
widget here:(note that's for binding in insert mode, not normal/command mode)