jerrypnz / major-mode-hydra.el Goto Github PK
View Code? Open in Web Editor NEWSpacemacs-esque major mode leader key powered by Hydra
Spacemacs-esque major mode leader key powered by Hydra
I'd like to define some mappings that do not show up on the hydra. Is there a way to do that?
Also, is there a way to (easily) define a blank line between the heads?
Sorry for bugging you again :)
I'm creating a Hydra for iedit
and noticed that it had a iedit-toggle-case-sensitive
command. This isn't a minor-mode though, so the :toggle
keyword set to t
will not work. There is a variable though named iedit-case-sensitive
which holds the state.
I made a small tweak to pretty-hydra--cell-docstring
so that you can specify a variable to check when using the :toggle
keyword.
(defun pretty-hydra--cell-docstring (width head)
"Generate docstring for a HEAD with given WIDTH."
(-let [(key cmd hint &plist :toggle toggle-p) head]
(cond
((char-or-string-p hint)
(if toggle-p
(let* ((expr (prin1-to-string `(pretty-hydra-toggle
;; This is the changed part
,hint (bound-and-true-p ,(if (eq t toggle-p)
cmd
toggle-p)))))
(width (+ width (- (+ (length expr) 2) (+ (length hint) 4)))))
(list (s-pad-right width " " (format " _%s_: %%s%s" key expr))))
(list (s-pad-right width " " (format " _%s_: %s" key hint))))) ;; string hint
((or (null hint))
;; no hint, use command name
(list (s-pad-right width " " (format " _%s_: %s" key
(or (ignore-errors (symbol-name cmd))
cmd)))))
(t
(list (format " _%s_: %%s%s"
key
(prin1-to-string
`(pretty-hydra--pad-or-trunc-hint ,hint ,(- width (length key) 5)))))))))
This allows me to define a Hydra like this:
(pretty-hydra-define iedit-hydra (:title "IEdit" :hint nil)
("Navigate" (("j" iedit-next-occurrence "next")
("k" iedit-prev-occurrence "previous")
("<" iedit-goto-first-occurrence "first")
(">" iedit-goto-last-occurrence "last")
("h" iedit-show/hide-unmatched-lines "hide"))
"Restrict" (("c" iedit-toggle-case-sensitive "case" :toggle iedit-case-sensitive)
("f" iedit-restrict-function "function")
("l" iedit-restrict-current-line "line")
("i" iedit-toggle-selection "toggle")
("n" iedit-expand-down-to-occurrence "down-expand")
("p" iedit-expand-up-to-occurrence "up-expand"))
"Edit" (("r" iedit-replace-occurrences "replace" :exit t)
("d" iedit-delete-occurrences "delete" :exit t)
("1" iedit-number-occurrences "number")
("m" iedit-switch-to-mc-mode "multiple-cursors" :exit t))))
I didn't bother to create yet another PR, but feel free to use it or adapt it if you find it useful!
Example which demonstrates the error (the "^" character in the last line of "Special" breaks the entire last line of the hydra):
(major-mode-hydra-define org-mode
(:exit nil :quit-key ("q" "<escape>"))
("Special"
(("," org-ctrl-c-ctrl-c "ctrl-c-ctrl-c")
("*" org-ctrl-c-star "ctrl-c-star")
("-" org-ctrl-c-minus "ctrl-c-minus")
("." org-priority "set priority")
("^" org-sort "sort"))
"Scheduling"
(("s" org-schedule "org-schedule")
("d" org-deadline "deadline"))
"Todo"
(("T" org-todo "menu")
("H" org-shiftleft "left")
("J" org-shiftdown "down")
("K" org-shiftup "up")
("L" org-shiftright "right"))
"Insert"
(("ia" org-attach "attach")
("il" org-insert-link "link")
("if" org-footnote-new "footnote"))
"Org"
(("r" org-refile "refile")
("R" helm-org-rifle "rifle"))
"Navigation"
(("N" org-next-block "next block")
("P" org-previous-block "previous block")
("n" org-next-link "next link")
("p" org-previous-link "previous link")
("o" org-open-at-point "open link"))))
*Warnings*
buffer content:
Warning (emacs): Unrecognized key: _: sort _
Warning (emacs): Unrecognized key: _: right _
The same example without the ^
key:
(major-mode-hydra-define org-mode
(:exit nil :quit-key ("q" "<escape>"))
("Special"
(("," org-ctrl-c-ctrl-c "ctrl-c-ctrl-c")
("*" org-ctrl-c-star "ctrl-c-star")
("-" org-ctrl-c-minus "ctrl-c-minus")
("." org-priority "set priority"))
"Scheduling"
(("s" org-schedule "org-schedule")
("d" org-deadline "deadline"))
"Todo"
(("T" org-todo "menu")
("H" org-shiftleft "left")
("J" org-shiftdown "down")
("K" org-shiftup "up")
("L" org-shiftright "right"))
"Insert"
(("ia" org-attach "attach")
("il" org-insert-link "link")
("if" org-footnote-new "footnote"))
"Org"
(("r" org-refile "refile")
("R" helm-org-rifle "rifle"))
"Navigation"
(("N" org-next-block "next block")
("P" org-previous-block "previous block")
("n" org-next-link "next link")
("p" org-previous-link "previous link")
("o" org-open-at-point "open link"))))
In regular hydra the ^
character can be displayed in the docstring if it's first escaped with two slashes: _\\^_
, maybe this mechanism could be used here when generating the docstring?
The Readme of this project doesn't mention what the differences between hydra and pretty hydra are.
According to the Commentary section in pretty-hydra.el
;; Provides a macro, `pretty-hydra-define', which defines a hydra with
;; column for each group of heads.
Is this everything? It would be nice, if this were mentioned in the Readme.
I have defined the following pretty-hydra for omni-scratch package:
(use-package omni-scratch
:custom
(omni-scratch-pale-background nil)
:pretty-hydra
((:color amaranth :quit-key "q" :title "Omni scratch buffer management")
("Omni Scratch"
(("DEL" omni-scratch "omni-scratch")
("-" omni-scratch-major "major mode")
("_" omni-scratch-buffer "buffer")
("$" omni-scratch-goto-latest "goto latest")
("b" omni-scratch-buffers "buffers"))
"Quit"
(("q" nil "Quit hydra"))))
:bind
("C-c $" . omni-scratch-hydra/body))
After trying to trigger the omni-scratch-hydra, it raises the following error:
apply: Wrong type argument: stringp, nil
Is the hydra definition wrong? Or is it some other issue?
Hi! Thank you for this nice package!
Hydra now have a function called defhydra+
which can be used to add heads to an already existing hydra. See: https://oremacs.com/2019/05/18/hydra-0.15.0/
Would it be possible for pretty-hydra
to do something similar?
Lets suppose I have a simple hydra for python-mode:
(use-package major-mode-hydra
:ensure t
:bind
("M-SPC" . major-mode-hydra))
(major-mode-hydra-define python-mode (:quit-key ("<escape>" "q"))
("Eval"
(("i" elpy-importmagic-fixup "Importmagic fixup")
("d" elpy-goto-definition "Goto definition"))))
(global-set-key (kbd "M-<SPC> emr") 'restart-emacs)
There is a conflict with M-<SPC>
of course.
Can I do it with major-mode-hydra?
Firstly, thank you for the LOVELY package. Coming from vim, hydra combined with major / pretty mode hydra is a lovely alternative to the Evil impedance mismatch.
What I am wondering is if there is a way to bind a key to hide the menu while still keeping the hydra active? This seems to exist in the regular hydra (abo-abo/hydra#301 (comment)) but I am wondering how I'd recreate something like that with the pretty hydra?
Thanks!
I'm trying to pass an s-expression to :title
in pretty-define-hydra
but it doesn't seem to be working. Can you give an example of how this feature is supposed to work?
Hi,
I want to share some configuration among different modes, but I do not find how to pass the shared argument to the macro.
I think the question is more related to my competence in emacs lisp than directly to major-mode-hydra, but since the use case is specific to this package, I ask my question here.
Let's take this small example of my current configuration (simplified).
(major-mode-hydra-define+ c++-mode nil
("cmake"
(("m x" cmake-build-set-cmake-profile "profile" :color amaranth)
("m v" cmake-build-run-cmake "cmake run" :color amaranth)
("m b" cmake-build-current "build" :color blue)
)))
(defhydra cmake-mode-hydra
(:color amaranth)
("m x" cmake-build-set-cmake-profile "profile" :color amaranth)
("m v" cmake-build-run-cmake "run cmake" :color amaranth)
("m b" cmake-build-current "build" :color blue)
("q" nil nil :exit t)
)
I do not find how to set a variable VAR to
("m x" cmake-build-set-cmake-profile "profile" :color amaranth)
("m v" cmake-build-run-cmake "cmake run" :color amaranth)
("m b" cmake-build-current "build" :color blue)
and use it in both macro call like
(major-mode-hydra-define+ c++-mode nil
("cmake"
(VAR
)))
(defhydra cmake-mode-hydra
(:color amaranth)
VAR
("q" nil nil :exit t)
)
I have tried different quote, unquote, funcall ... it may be a newbe question, any help or documentation ref would be appreciated. Thanks.
I'm having a strange issue with pretty hydras when using hydra-posframe. I'm not even sure this will be the right place to ask, but here we go anyway. I'm happy to help troubleshoot or resolve this any way I can; I'm still getting a handle on debugging elisp.
When showing a pretty hydra in a posframe, the frame will be sized two lines smaller than it should be, so it won't show the last line of the hydra or the blank line after it:
If I put a :min-height
on the posframe, the content will all be there:
And if I use the lv
hydra display type, it will show all the content, although it looks like it's not getting an extra blank line at the bottom (assuming it's supposed to):
That hydra definition looks like this:
(major-mode-hydra-define emacs-lisp-mode
(:color amaranth :quit-key ("q" "<escape>"))
("Eval"
(("b" eval-buffer "buffer" :exit t)
("e" eval-defun "defun")
("r" eval-region "region"))
"REPL"
(("I" ielm "ielm"))
"Doc"
(("d" describe-foo-at-point "thing-at-pt")
("f" describe-function "function")
("v" describe-variable "variable"))))
Any ideas on this? Thanks in advance for any help you can give, and thanks for a really useful package.
A nice feature would be being able to specify an exit head independent from any column and having it show under the Hydra. This would probably just look a little nicer than having to stick an exit head on a column.
It would be useful to specify multiple quit keys, e.g.
(pretty-hydra-define foo (:quit-key ("q" "ESC")...
Hello,
I've got a problem loading the :pretty-hydra
keyword for use-package even if I request it with :demand t
. Do you have any tips for this? Thanks
(use-package hydra)
(use-package pretty-hydra
:demand t
:after (hydra))
Multiple major modes sharing the same hydra, notably clojure-mode
, clojurescript-mode
, clojurec-mode
and cider-repl-mode
etc.
It would be great if we could use the major-mode-hydra-bind
or alternative macro to create columns which have pre-made docstrings. I would like to use major-mode-hydra to replicate this Hydra:
(defhydra hydra-org (: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)))
Hello! Great package. I've written a function to generate major mode keybindings lists where the functions are prefixed with C-c C-KEY where KEY is used for the activation key in the hydra. The first line of the function's documentation is pulled in. It serves as a good starting point for defining a major mode hydra.
Example usage:
(flat-hydra-commands 'emacs-lisp-mode-map) =>
(("b" elisp-byte-compile-buffer
"Byte compile the current buffer, but don’t write a file.")
("f" elisp-byte-compile-file
"Byte compile the file the current buffer is visiting.")
("e" elisp-eval-region-or-buffer
"Evaluate the forms in the active region or the whole current buffer."))
It can also be used interactively with which-key keymap completion.
It's left to the user to group the functions and change the descriptions as they like. I was thinking of a way to group similar functions using their broken up command names, but this is probably good enough. It seems like the whole idea of hydras are bespoke menus anyway.
Relies on functions from embark and which-key, reproduced below.
Code:
;; Source: embark
;; https://github.com/oantolin/embark
(defun embark--all-bindings (keymap &optional nested)
"Return an alist of all bindings in KEYMAP.
If NESTED is non-nil subkeymaps are not flattened."
(let (bindings maps)
(map-keymap
(lambda (key def)
(cond
((keymapp def)
(if nested
(push (cons (vector key) def) maps)
(dolist (bind (embark--all-bindings def))
(push (cons (vconcat (vector key) (car bind)) (cdr bind))
maps))))
(def (push (cons (vector key) def) bindings))))
(keymap-canonicalize keymap))
(nconc (nreverse bindings) (nreverse maps))))
;; Source: which-key
;; https://github.com/justbur/emacs-which-key
(defvar which-key-keymap-history nil
"History of keymap selections in functions like
`which-key-show-keymap'.")
(defun which-key--read-keymap ()
"Read keymap symbol from minibuffer."
(intern
(completing-read "Keymap: " obarray
(lambda (m)
(and (boundp m)
(keymapp (symbol-value m))
(not (equal (symbol-value m)
(make-sparse-keymap)))))
t
(let ((sym (symbol-at-point)))
(and (boundp sym)
(keymapp (symbol-value sym))
(symbol-name sym)))
'which-key-keymap-history)))
(defun index-to-string (index)
"Convert positive integers less than 27 to corresponding letters."
(when (< index 27)
(char-to-string (+ index 96))))
(defun c-bindings (keymap)
"List of binding letters prepended with C-c and their functions from KEYMAP."
(delq nil (mapcar (lambda (binding)
(when (eq 3 (aref (car binding) 0))
(list (index-to-string (aref (car binding) 1))
(cdr binding))))
(embark--all-bindings keymap))))
(defun flat-hydra-commands (keymap)
"Insert c-prefixed bindings of KEYMAP into buffer."
(interactive (list (which-key--read-keymap)))
(cl-prettyprint
(cl-remove-duplicates
(mapcar (lambda (binding)
(append binding (list (car (s-lines (documentation (car (cdr binding))))))))
(c-bindings (symbol-value keymap)))
:test (lambda (x y) (equal (car x) (car y))))))
This might be useful in the wiki, or for anyone who stumbles on this issue.
I would like to have different hydra for different major-mode.
Lets suppose this my config:
(use-package major-mode-hydra
:ensure t
:bind
("M-SPC" . major-mode-hydra))
(major-mode-hydra-define (emacs-lisp-mode python-mode) nil
("Emacs"
(("<escape>" nil "quit")
("q" nil "quit"))))
(major-mode-hydra-define+ emacs-lisp-mode nil
("Eval"
(("b" eval-buffer "buffer")
("e" eval-defun "defun"))))
(major-mode-hydra-define+ python-mode nil
("Eval"
(("i" elpy-importmagic-fixup "Importmagic fixup")
("d" elpy-goto-definition "Goto definition"))))
I expected to see in python-mode the following:
Eval
"i": "Importmagic fixup"
"d": "Goto definition"
However union of columns seem to happen:
Eval
"b" eval-buffer "buffer"
"e" eval-defun "defun"
"i": "Importmagic fixup"
"d": "Goto definition"
How can I get the expected results?
e.g.
(major-mode-hydra-bind-key 'emacs-lisp-mode "Emacs"
("b" #'foo "Foo")
("c" #'bar "Bar"))
Hi,
I'm trying to setup a specific pretty-hydra, but it miss the last line. I home my general configuration do not break somthing. I have
(setq hydra-posframe-show-params '(:internal-border-width 1 :internal-border-color "#c6c6c6" :horizontal-scroll-bars 't :poshandler posframe-poshandler-frame-bottom-center)
(use-package pretty-hydra)
(use-package major-mode-hydra
:ensure t
:config
(setq hydra-hint-display-type 'posframe)
(setq major-mode-hydra-invisible-quit-key "q")
:bind
("M-SPC" . major-mode-hydra))
(pretty-hydra-define test-hydra
(:title "TEST" :color amaranth :quit-key "q")
("hello"
(("cmp" nil "profile" )
("cmc" nil "cmake")
("cmb" nil "build")
)))
When I call test-hydra/body only "profile" and "cmake" are shown in the posframe, not "build".
Any advice on where to search what i'm doing bad ? If I set hydra-hint-display-type to 'lv everything looks fine.
++
Thanks for making this tool, I use it all the time!
I often want to add a quick hydra with pretty-hydra-define
, and I'd love to have the default label for each key be the name of the command that it runs, instead of being blank. Perhaps it could even have a default but customizable transformation of the name, such as stripping the name of the major mode off the front.
I'd love to hear your thoughts!
I have the following use package config:
(use-package emacs-lisp-mode
:ensure nil
:after (major-mode-hydra)
:mode-hydra
("Eval"
(("b" eval-buffer "buffer")
("e" eval-defun "defun")
("r" eval-region "region"))
"REPL"
(("I" ielm "ielm"))
"Test"
(("t" ert "prompt")
("T" (ert t) "all")
("F" (ert :failed) "failed"))
"Doc"
(("d" describe-foo-at-point "thing-at-pt")
("f" counsel-describe-function "function")
("v" counsel-describe-variable "variable")
("i" info-lookup-symbol "info lookup"))
"Quit"
(("q" nil "quit hydra"))))
I have also tried :defer t
. I keep getting the following warning:
Error (use-package): Failed to parse package emacs-lisp-mode: use-package: Unrecognized keyword: :mode-hydra
The way I setup major-mode-hydra
is:
(use-package major-mode-hydra
:bind
("M-SPC" . major-mode-hydra))
The order of appearance of them is also sequential. I load major-mode-hydra just after (require 'use-package)
and emacs-lisp-mode is loaded quite later.
I have this config:
(require 'pretty-hydra)
(pretty-hydra-define jp-toggles
(:color amaranth :quit-key "q" :title "My Toggle")
("Basic"
(("n" linum-mode "line number" :toggle t)
("w" whitespace-mode "whitespace" :toggle t)
("W" whitespace-cleanup-mode "whitespace cleanup" :toggle t)
("r" rainbow-mode "rainbow" :toggle t)
("L" page-break-lines-mode "page break lines" :toggle t))
"Highlight"
(("s" symbol-overlay-mode "symbol" :toggle t)
("l" hl-line-mode "line" :toggle t)
("x" highlight-sexp-mode "sexp" :toggle t)
("t" hl-todo-mode "todo" :toggle t))
"UI"
(("d" jp-themes-toggle-light-dark "dark theme" :toggle jp-current-theme-dark-p))
"Coding"
(("p" smartparens-mode "smartparens" :toggle t)
("P" smartparens-strict-mode "smartparens strict" :toggle t)
("S" show-smartparens-mode "show smartparens" :toggle t)
("f" flycheck-mode "flycheck" :toggle t))
"Emacs"
(("D" toggle-debug-on-error "debug on error" :toggle (default-value 'debug-on-error))
("X" toggle-debug-on-quit "debug on quit" :toggle (default-value 'debug-on-quit)))))
And when I execute: M-x jp-toggles/body
, I find that columns cannot left-justified:
Can you help me? How to solve this problem? thank u :)
I just discovered this package, and think it is an amazing idea (may only be a small wrapper around hydra, but is incredibly useful for those of us that want to use a major mode leader key, like spacemacs's SPC m
). I actually originally thought it contained hydras for a bunch of major modes, then realized it just helped you make them. I was thinking though, while people will want to choose their own keybindings, since there are only so many major modes (and especially a limited number of popular ones, i.e. major modes for the popular languages) with a limited number of functions, wouldn't it be helpful if people could go out and find code for the major modes they use? I understand not including them in the package (outside of scope, also forces your logic behind keybindings on others), but could we do something like have a section in the README where other users submit configs for popular major modes using this package?
It would be really nice if future first-timers could land on this, install it, then copy configs of major modes they use, and then, once they get the idea and find what is useful to them and what isn't, they can modify it from there. As is, I feel like a lot fo us are writing very similar code, we just need a place to share configs for this package!
I know this goes against the package name but is there any reason you don't support minor modes?
I have similar functionality to this package in my dotfiles but when I switched over to this package I noticed it was missing minor mode support.
Is there any chance of this being added?
Thanks!
Allow specifying a predicate for a column or a head which decides if the column / head should be displayed or not
I'm trying to compose hydras based on which minor modes are active. For instance, I have this hydras for flycheck and eglot:
(pretty-hydra-define my:flycheck-hydra ()
("Errors"
(("<" flycheck-previous-error "prev" :exit nil)
(">" flycheck-next-error "next" :exit nil)
("l" flycheck-list-errors "list"))))
(pretty-hydra-define my:eglot-hydra ()
("Eglot"
(("f" eglot-format)
("r" eglot-code-actions))))
And I want them both to appear if eglot is active and flycheck is active, alongside the major mode hydra. So, for example, I'd like an easy way to combine those with my python-specific hydra so that the final result is the same as using the following hydra:
(major-mode-hydra-define python-mode nil
("Nav"
(("n" python-nav-forward-defun "next-defun" :exit nil)
("p" python-nav-backward-defun "prev-defun" :exit nil))
"Errors"
(("<" flycheck-previous-error "prev" :exit nil)
(">" flycheck-next-error "next" :exit nil)
("l" flycheck-list-errors "list"))
"Env"
(("a" pipenv-activate "pipenv-activate" :exit nil)
("d" pipenv-deactivate "pipenv-deactivate" :exit nil)
("w" pyvenv-workon "workon...")
("s" run-python "pyshell"))
"Tools"
(("f" blacken-buffer "reformat")
("i" py-isort-buffer "sort imports"))
"Test"
(("t" python-pytest-popup "pytest..."))
"Eglot"
(("f" eglot-format)
("r" eglot-code-actions))))
For multibyte characters, the width of the character displayed is different from the number returned by the "length" function,
so the output results are out of alignment.
So I use string-width function to fix it for me.
Things seem to be going well in my environment.
Thanks for the great extension. Just a quick report.
;; (string-width "日本語") => 6
;; (length "日本語") => 3
(defun pretty-hydra--cell-docstring (width head)
"Generate docstring for a HEAD with given WIDTH."
(-let* (((key cmd hint &plist :toggle toggle-p) head)
(escaped-key (s-replace "^" "\\^" key))
;; If any character gets escpaed, we need to increase the
;; width as well because the espace char \ is not displayed.
(width (+ width (- (length escaped-key) (length key)))))
(cond
((char-or-string-p hint)
(if toggle-p
(let* ((status-expr (cond
((eq toggle-p t) `(bound-and-true-p ,cmd))
((listp toggle-p) toggle-p)
(t `(bound-and-true-p ,toggle-p))))
(expr (prin1-to-string `(pretty-hydra-toggle ,hint ,status-expr)))
;; (width (+ width (- (+ (length expr) 2) (+ (length hint) 4))))
(width (+ width (- (+ (length expr) 2) (+ (string-width hint) 4))))
)
(list (s-pad-right width " " (format " _%s_: %%s%s" escaped-key expr))))
(-let* ((escaped-hint (s-replace "^" "\\^" hint))
;; (width (+ width (- (length escaped-hint) (length hint))))
(width (+ width (- (length escaped-hint) (string-width hint))))
)
(list (s-pad-right width " " (format " _%s_: %s" escaped-key escaped-hint)))))) ;; string hint
((or (null hint))
nil) ;; no hint, doesn't show it in docstring at all
(t
(list (format " _%s_: %%s%s"
escaped-key
(prin1-to-string
`(pretty-hydra--pad-or-trunc-hint ,hint ,(- width (length key) 5)))))))))
Thx for your package. Used to use a hackish solution before.
What I'm missing from my solutions is to be able to customize the separator between the column headings. In my case it was two spaces:
This somehow helps me to visually see the columns better.
Is this already possible or can this be implemented?
In pretty-hydra--maybe-add-title
the title and body are formatter with the string "\n %s\n%s"
. I think it would be nice if this was customizable in some way
Since a newline is pre-pended to the docstring anyway in pretty-hydra--generate
, this results in a docstring with " \n\n<title>"
. Nothing against the aesthetics, but I prefer not to have any empty newlines above the title, since I prefer a compact hydra. At the moment I just do :formatter s-trim-left
which is enough for me.
So it's not a huge issue, but adding something like a custom formatter string should be pretty to implement. Ideally there would be a defcustom
for a default value (to address #29) and a body keyword like :formatter
, e.g. :title-body-format-spec
.
Hi, this package is what I've been looking for!
In README, https://github.com/jerrypnz/major-mode-hydra.el#pretty-hydra
(defvar jp-window--title (with-faicon "windows" "Window Management" 1 -0.05))
(pretty-hydra-define jp-window (:foreign-keys warn :title jp-window--title :quit-key "q")
("Actions"
(("TAB" other-window "switch")
("x" ace-delete-window "delete")
("m" ace-delete-other-windows "maximize")
("s" ace-swap-window "swap")
("a" ace-select-window "select"))
"Resize"
(("h" move-border-left "←")
("j" move-border-down "↓")
("k" move-border-up "↑")
("l" move-border-right "→")
("n" balance-windows "balance")
("f" toggle-frame-fullscreen "toggle fullscreen"))
"Split"
(("b" split-window-right "horizontally")
("B" split-window-horizontally-instead "horizontally instead")
("v" split-window-below "vertically")
("V" split-window-vertically-instead "vertically instead"))
"Zoom"
(("+" zoom-in "in")
("=" zoom-in)
("-" zoom-out "out")
("0" jp-zoom-default "reset"))))
but with-faicon
is not defined in my Emacs. it is typo, or something definition missing?
I use Emacs-27.1.
Sometimes when I have like a big hydra, I mess up the configuration and duplicate some symbols.
This can be easily solve with a simple check of the major-mode/MODE/heads, but I think it may be interesting to implement
it into the macro major-mode-hydra-define (or somewhere else), I can develop that feature if you think is useful for the package.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.