Hot answers tagged

5

Here's how to do it: (defhydra hydra-transpose () "transposing hydra" ("l" transpose-lines "lines") ("w" transpose-words "words") ("s" transpose-sexps "sexps") ("p" transpose-paragraphs "paragraphs") ("c" transpose-chars "characters") ("w" transpose-frame "windows")) (global-set-key (kbd "C-t") 'hydra-transpose/body) See the documentation for ...


5

You can pass the directory name to dired: (defhydra hydra-dired (:exit t) "dired" ("w" (dired "~/Downloads") "Downloads") ("d" (dired "~/Documents") "Documents")) (global-set-key (kbd "C-c C-d") 'hydra-dired/body)


4

The package use-package-hydra, which is also available on MELPA, should solve this problem. I combined your code blocks into a single (use-package) expression (see keywords :after, :bind and :hydra). Note the missing defhydra. (use-package undo-tree :ensure t :diminish (undo-tree-mode . "") :after hydra :bind ("C-x u" . hydra-undo-tree/undo-tree-...


3

You can do this by maintaining a stack of hydras, as described on the hydra wiki page Nesting Hydras. The basic mechanism described there is to add your own push/pop commands. See the full example for details, but here are the key pieces: (defvar hydra-stack nil) (defun hydra-push (expr) (push `(lambda () ,expr) hydra-stack)) (defun hydra-pop () (...


3

Oh. wow. Spacemacs's define-transient-state is really nice: (spacemacs|define-transient-state dired-open-item-other-window :title "Open item in other window" :doc "\n[_j_/_k_] down/up [_h_/_l_] left/right [_q_] quit" :bindings ("j" dired-find-file-other-window-below :exit t) ("k" dired-find-file-other-window-above :exit t) ("h" dired-find-file-...


2

To highlight after each switch, even when the hydra hasn't exited yet, you can use this: (defhydra windows (global-map "C-c w" :after-exit flash-active-buffer) "window moving" ("o" other-window "other")) Another approach, which I think is actually better, since it's more straight forward: (defhydra windows (global-map "C-c w") "...


2

I am not sure whether Hydra supports this (like you I would have to look at the documentation to be sure). I think it only supports setting the value of lisp variables, but not arguments to commands. Magit's popup functionality is available as a separate package magit-popup. It comes with a manual.


2

In my case hydra-ivy looks a bit different but one can see that here & is just a part of the description of the command being executed. The commands themselves are the usual ivy commands. For instance [RET] will call ivy-done and I guess that [i] will close the hydra and insert the current match into the minibuffer while [q] will just close the hydra. ...


2

This was way more subtle than I would have expected! Some keys seem to be to set :demand t to make sure it gets loaded, and to set the key binding in the undo-tree-map which is where C-x u is defined. After that, this seems to work for me without any additional packages. (use-package undo-tree :ensure t :demand t :diminish (undo-tree-mode . "") :...


2

I believe the missing link you're looking for is listify-key-sequence, which will "convert a key sequence to a list of events". Luckily, this works for both key sequences and for the values returned by kbd, so the following should return true: (equal (listify-key-sequence [?\C-b]) (listify-key-sequence (kbd "C-b"))) So your function would be: (...


1

I posted on your Spacemacs issue as well, but thought I'd share my answer here too. The issue here is that the hydra you are viewing when pressing C-o is not the Ivy hydra. It is a custom hydra set by spacemacs|define-transient-state in the spacemacs-completion layer that @andrej mentioned. When you press C-o while in an Ivy buffer in Spacemacs, it ...


1

Maybe something like this will do what you want: (defhydra hydra-keyboard-macros (:columns 6 :foreign-keys run) ("e" kmacro-end-or-call-macro-repeat "execute") ("u" (lambda() (interactive) (let ((current-prefix-arg 0)) (call-interactively #'kmacro-end-or-call-macro))) "unlimited") ("s" (lambda () (interactive) (...


1

I agree that editing hydra hints manually is tedious, but in this particular case you could use M-x overwrite-mode (bound to <insert> for me). That would preserve the column widths.


1

Do they work without using your hydra? If so, the hydra is likely where your problem is. Please try to provide a step-by-step recipe to reproduce the problem, starting with emacs -Q, using a simple bookmark file (even with just one bookmark), and saying what you expect to see at each step and what you do see instead. The error raised from bmkp-jump-1 says ...


Only top voted, non community-wiki answers of a minimum length are eligible