org-ref meets hydra

| categories: emacs | tags: | View Comments

I am enjoying learning about abo-abo/hydra , which is a nice package for making minibuffer menus to run commands. It is light-weight solution that does not mess up your window too much, and it is easier to use than any home-grown solution I have made in the past. Here is a simple little code that gives me three options when I press "zz" quickly (a key-chord). I can press "c" to put in a cite link using helm, "r" to insert a ref link using helm, and "l" to insert a new label. Any other key just cancels the menu. One thing to remember ("zz"), and hints for the rest!

(require 'hydra)
(setq hydra-is-helpful t)

(require 'key-chord)
(key-chord-mode 1)
(key-chord-define-global
 "zz"
 (defhydra org-ref-hydra ()
   "org-ref"
   ("c" org-ref-helm-insert-cite-link "cite")
   ("r" org-ref-helm-insert-ref-link "ref")
   ("l" org-ref-helm-insert-label-link "label")
   ("R" org-ref "org-ref")))
org-ref-hydra/body

Pretty nice. Check out the nice hydra interface to words.el . A simple press of "ww" gets you easy access to single key presses of all the nice words functions. What would you hydra for?

Copyright (C) 2015 by John Kitchin. See the License for information about copying.

org-mode source

Org-mode version = 8.2.10

blog comments powered by Disqus