From: Peng Li Date: Sat, 30 Apr 2016 17:40:50 +0000 (+0800) Subject: emacs - aadd hydra mapping X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;ds=sidebyside;h=2aa029cbec84b94f299c23e3aca18db6e7259fe3;p=dotfiles.git emacs - aadd hydra mapping --- diff --git a/emacs.d/elisp/init-hydra.el b/emacs.d/elisp/init-hydra.el new file mode 100644 index 0000000..2c64061 --- /dev/null +++ b/emacs.d/elisp/init-hydra.el @@ -0,0 +1,46 @@ + +;; key mapping +;; TODO: +;; 1. exec external progeam +;; prefix + s : eshell / term +;; prefix + p : package install +;; prefix + +;; 2. prefix for magit +;; +;; 3. prefix for avy motion +;; 4. window / buffer switch +;; 5. file project switch +(use-package hydra + :ensure t + :config + (hydra-add-font-lock)) + + +(defhydra hydra-external (global-map "") + "zoom" + ("g" text-scale-increase "in") + ("l" text-scale-decrease "out") + ) + + +;; hydra for Misc commands +(defhydra hydra-misc (:exit t) + "Misc Commands" + ("e" eshell "eshell" :color red) + ("p" (lambda () + (interactive) + (if (pl/buffer-exist "*Packages*") + (switch-to-buffer "*Packages*") + (package-list-packages))) + "List-package" :color red) + ) +(defun pl/buffer-exist (bufname) (not (eq nil (get-buffer bufname)))) +(global-set-key (kbd "") 'hydra-misc/body) + + + + + + + +(provide 'init-hydra)