Is there a way to bind keys across all modes? For example I have one binding:

  (define-key evil-normal-state-map (kbd "gt") 'persp-next)

This works fine in some modes, but not in others, like org-mode, where you have to add a specific binding:

  (evil-define-key 'normal org-mode-map (kbd "gt") 'persp-next)

This works, but it's annoying to have to define bindings for every major-mode. The final option, global bindings, doesn't seem to work at all without accelerator keys:

   (global-set-key (kbd "gt") 'persp-next)

One potential solution would be to use key-chord-mode and the function in that mode: key-chord-define-global.

With this mode, once you have enabled it with (key-chord-mode 1), you can set a global keybinding like this:

(key-chord-define-global "jj" 'helm-projectile-find-file)

This is an example that I use personally, but you can of course add your own functions in place of helm-projectile-find-file, and replace "jj" with your desired key combination (I don't use evil, but I would assume that something like (key-chord-define-global "gt" 'persp-next) would work for you). The combinations are case-sensitive too, so "jj" is different from "JJ".

This should allow you to set the kind of bindings you want, without using a modifier key like C-, M-, etc. Here is a nice video demo.

  • I tried it out, but it didn't seem to work with casing, "gT" would override "gt" for instance. Another issue is that it's global, I don't want the chords to work in insert mode. It also warns on your link that it doesn't work well with evil. – flukus Feb 23 '16 at 21:01
  • @flukus ah, that's too bad. Like I said, I didn't test it with evil. Hopefully someone else will have a good solution! – elethan Feb 23 '16 at 21:07

Started such a project here:


It's still alpha, bug-reports welcome anyway.

This site is temporarily in read only mode and not accepting new answers.

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