emacs - aadd hydra mapping
authorPeng Li <seudut@gmail.com>
Sat, 30 Apr 2016 17:40:50 +0000 (01:40 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 30 Apr 2016 17:40:50 +0000 (01:40 +0800)
emacs.d/elisp/init-hydra.el [new file with mode: 0644]

diff --git a/emacs.d/elisp/init-hydra.el b/emacs.d/elisp/init-hydra.el
new file mode 100644 (file)
index 0000000..2c64061
--- /dev/null
@@ -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 "<f2>")
+  "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 "<f3>") 'hydra-misc/body)
+
+
+
+
+
+
+
+(provide 'init-hydra)