How to assign multiple key combinations to `evil-escape-key-sequence` in spacemacs?

966 Views Asked by At

I'd like to assign multiple key combinations that would exit vim insert mode in spacemacs. I tried:

(setq-default evil-escape-key-sequence "fj" "jf" "fd" "df")

But only the first one works. How should I do it properly?

2

There are 2 best solutions below

0
On BEST ANSWER

This can be set with the evil-escape-unordered-key-sequence variable:
SPC SPC customize-variable RET evil-escape-unordered-key-sequence, then hit Toggle, then hit Apply and Save.

See SPC h d v evil-escape-unordered-key-sequence for more details.

0
On

Currently you can't assign multiple keys to evil-escape-key-sequence but there is simple workaround to achieve the same result: (source):

  1. add key-chord to dotspacemacs-additional-packages
  2. in dotspace/user-config () add
    (key-chord-mode 1)
    (key-chord-define evil-insert-state-map "fd" 'evil-escape)
    
  3. restart spacemacs

And now both combinations, default (df / fd) and new (fj / jf) work.