Giter Site home page Giter Site logo

Comments (4)

jerrypnz avatar jerrypnz commented on September 24, 2024
  1. I would like to have some key bindings that work in all modes (major or minor).

You can use pretty-hydra and bind it to a global key.

  1. And I would like hydra not to show hint for the key binding.

Don't think you can hide the hint completely but you can set an idle delay, e.g.

(pretty-hydra-define test-hydra (:quit-key ("<escape>" "q") :idle 1.5)
  ("Eval"
   (("i" elpy-importmagic-fixup "Importmagic fixup")
    ("d" elpy-goto-definition "Goto definition"))))

from major-mode-hydra.el.

Pfedj avatar Pfedj commented on September 24, 2024

You can use pretty-hydra and bind it to a global key.

I have bind my pretty-hydra to the global key this way:

(defun Pfedj/hydra-test ()
  (interactive)
  (funcall
   (pretty-hydra-define test-hydra (:quit-key ("<escape>" "q"))
  ("Eval"
   (("i" elpy-importmagic-fixup "Importmagic fixup")
    ("d" elpy-goto-definition "Goto definition"))))))

(global-set-key (kbd "M-<SPC>") 'Pfedj/hydra-test)

I would like to add heads to an already existing test-hydra:

(pretty-hydra-define+ test-hydra (:quit-key ("<escape>" "q") :idle 1.5)
  (;; these heads are added to the existing "Eval" column
   "Eval"
   (("r" transpose-frame "rotate")
    ("z" zone "zone out!"))
   ;; this is a new column, which gets added
   "Appearance"
   (("f" set-frame-font "font")
    ("t" load-theme "theme"))))

It doesn't work. How can I do it?

from major-mode-hydra.el.

jerrypnz avatar jerrypnz commented on September 24, 2024

It doesn't work because every time Pfedj/hydra-test is called, your hydra is re-defined with pretty-hydra-define which blows away the existing one. You don't really need that wrapper function, just bind the hydra body to a key:

(pretty-hydra-define test-hydra (:quit-key ("<escape>" "q"))
  ("Eval"
   (("i" elpy-importmagic-fixup "Importmagic fixup")
    ("d" elpy-goto-definition "Goto definition"))))

(global-set-key (kbd "M-<SPC>") 'test-hydra/body)

from major-mode-hydra.el.

Pfedj avatar Pfedj commented on September 24, 2024

I have lost postfix /body when I try to bind hydra with global-set-key as you describe. So it works. Thank you for you clarification.

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.