8000 Feature request: share heads among different hydras · Issue #57 · abo-abo/hydra · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Feature request: share heads among different hydras #57
Closed
@zhaojiangbin

Description

@zhaojiangbin

I have different hydras using exactly same subset of heads. For example, for moving the point, both the vi-style navigation hydra and the rectangle operation hydra define h i j k heads to call same commands, respectively. Would it be possible to share these heads between the hydras?

An option is to define the common heads in a hydra and call it in bodies of vi-navigation and rect-ops. But that would require an extra pair of keys to enter and exit the sub-hydra.

I am thinking something like:

;; It could be implemented as a different function/macro if that would make more sense.
(defhydra common-heads ()
  ""
  ("h" backward-char)
  ...
  ("k" previous-line))

(defhydra vi-navigation ()
  ""
  (hydra-import common-heads :hint t) ;; shown in hint
  ("a" beginning-of-line)
  ;; other heads
  ...)

(defhydra rect-operations ()
  ""
  (hydra-import common-heads :hint nil) ;; hidden
  ;; other heads
  ...)

The function/macro hydra-import (I am making up the name here) would somehow make the heads h j k l available directly in the calling hydras. The property :hint tells whether these heads should show up in the calling hydras. Having the :exit and :foreign-keys properties would be useful, too.

I have to admit that this is only a nice-to-have minor feature. It might not even get much use. I am just tossing some ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0