From 926f144d6a47f66b1c84a74754f6802eb477801d Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 20 Jun 2016 11:47:20 -0700 Subject: [PATCH] Add key-chord bindings for commonly used commands Also includes imalison:disable-keychord-around which disables keychord around the invocation of some function. This is used with avy commands because those often require the user to type odd key combinations that might be used as keychords. --- dotfiles/emacs.d/README.org | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 15aa2b5a..ed3844d5 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -2466,11 +2466,28 @@ I don't use iedit directly, but it is used by [[*emr][emr]] and I need to disabl :config (progn (use-package company-restclient))) - #+END_SRC *** key-chord #+BEGIN_SRC emacs-lisp - (use-package key-chord) + (use-package key-chord + :preface + (defun imalison:disable-keychord-around (function &rest args) + (let ((key-chord-mode-was-enabled (bound-and-true-p key-chord-mode))) + (when key-chord-mode-was-enabled + (shut-up (key-chord-mode -1))) + (condition-case err (progn (apply function args)) + (error)) + (when key-chord-mode-was-enabled + (shut-up (key-chord-mode 1))))) + :config + (progn + (key-chord-mode 1) + (advice-add 'imalison:avy :around 'imalison:disable-keychord-around) + (key-chord-define-global "tg" 'imalison:term-hydra/body) + (key-chord-define-global "pj" 'imalison:projectile-find-file) + (key-chord-define-global "p[" 'projectile-switch-project) + (key-chord-define-global "sd" 'imalison:do-ag) + (key-chord-define-global "jh" 'imalison:avy))) #+END_SRC *** nodejs-repl #+BEGIN_SRC emacs-lisp