Giter Site home page Giter Site logo

Comments (2)

jerrypnz avatar jerrypnz commented on September 24, 2024

I designed this package in such a way that it dynamically recompiles the hydra one there is a change to its heads, but I guess some time it'd be useful to fully customize the hydra.

Maybe a new macro can be introduced, something like:

(major-mode-hydra-set org-mode hydra-org)

Before I get a chance to implement it, you can actually do this now by manually add the hydra to org-mode major-mode-hydra--body-cache:

(setf (alist-get 'org-mode major-mode-hydra--body-cache) hydra-org/body)

from major-mode-hydra.el.

jerrypnz avatar jerrypnz commented on September 24, 2024

Apart from the above hacky solution, you can also use defhydra directly as long as the name follows the same convention major-mode-hydras/<mode>, e.g.

(defhydra major-mode-hydras/org-mode (:hint nil :color red)
  "
   shift      header    level    ends    narrow

     K          p         k       a        o       [r] rifle        [SPC] cycle
     ↑          ↑         ↑       ↑        ↑       [v] avy           [t]  tidy mode:  %(org-tidy-p)
h  ←   →  l                                        [s] siblings      [L]  links
     ↓          ↓         ↓       ↓        ↓       [d] children
     J          n         j       e        i       [f] parents           level
                                                                 [ 1   2   3   4   5 ]
"
  ("<f19>" (funcall hera-default-hydra) nil :color blue)
  ;; shift
  ("h" org-promote-subtree)
  ("l" org-demote-subtree)
  ("K" org-move-subtree-up)
  ("J" org-move-subtree-down)
  ;; header
  ("p" org-backward-heading-same-level)
  ("n" org-forward-heading-same-level)
  ;; ends
  ("a" hydra-org-goto-first-sibling)
  ("e" hydra-org-goto-last-sibling)
  ;; level
  ("j" hydra-org-child-level)
  ("k" hydra-org-parent-level)
  ;; narrow
  ("o" nn-widen)
  ("i" nn-narrow)

  ("SPC" org-cycle)
  ("t" org-tidy)
  ("L" org-toggle-link-display)

  ("r" (lambda () (interactive)
         (helm-org-rifle-current-buffer)
         (call-interactively 'org-cycle)
         (call-interactively 'org-cycle)))
  ("v" avy-org-goto-heading-timer)
  ("s" avy-org-same-level)
  ("d" avy-org-child-level)
  ("f" avy-org-parent-level)
  ("S" (lambda () (interactive) (helm-org-in-buffer-headings) (org-cycle) (org-cycle)))

  ("1" (avy-org-goto-level 1))
  ("2" (avy-org-goto-level 2))
  ("3" (avy-org-goto-level 3))
  ("4" (avy-org-goto-level 4))
  ("5" (avy-org-goto-level 5)))

from major-mode-hydra.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.