I am writing my own Emacs config coming from doom-emacs and Spacemacs. One thing I really miss is the ability to split windows using split-window-below and split-window-right using S-w s s and S-w s v. I am trying to add this to my config and saw that doom-emacs use hydra for this, however, how they do it is like this:

(defhydra +hydra/window-nav (:hint nil)
  ("s" split-window-below)
  ("v" split-window-right)

Can see the source implementation here. I do not understand how it is connected. I tried to just copy their implementation like this:

(defhydra +hydra/window-nav (:hint nil)
  ("s" split-window-below)
  ("v" split-window-right))

But it is not working and did not expect that it would work, since we never bind space for example.. Anyone who could help me?

2 Answers 2


To understand hydra you should start at the original source page.

For a complete example of window management including your two keys see its wiki entry

You are missing the docstring - ie the menu displayed to the user.

As for binding space - I suspect that is done by Doom's macros which extent the original hydra's ones. In the example quit is done by the head ("q" nil)

I prefer to have the macro for a key binding generate the prompt in most cases so I use pretty hydra


Doom and Spacemacs use those keybindings 'directly', no hydra involved. The pop-up window showing the keybindings is provided by the package which-key.

Although you can define all those keybindings directly, I would advise you to start with using either the general.el or the bind-map package.

You can find a minimal example for how to setup a Spacemacs like setup from scratch, using bind-map, here. You can download the README.org file, visit it in Emacs and then do M-x org-babel-tangle to create the init.el file.

B.t.w. in Emacs S-w is not used, and using this might lead to confusion. There is s-w meaning 'super-w' and capital W meaning 'shift-w'. I assume that you mean SPC w here.

  • Just read this now and have a meeting in a few minutes, but doom-emacs use hydra! Watch this link: github.com/hlissner/doom-emacs/blob/master/modules/ui/hydra/… the same I linked above. But when I get home I will try them out and get back to you
    – page290
    Apr 30, 2022 at 19:37
  • That code is part of the hydra module, you have to add it first to get the hydra (including those keybindings you are pointing at). Normally, it somehow uses the evil-window-map behind SPC w. Apr 30, 2022 at 23:24
  • I find that that the hydra module is deprecated b.t.w. So, currently Doom is not using hydra's at all. Thanks to the wizkid who downvoted this answer b.t.w., very useful vote ;) May 2, 2022 at 21:12
  • 1
    @dalanicolai I bumped you back up. I know that you know what you're talking about.
    – g-gundam
    Jan 31, 2023 at 3:28
  • 1
    @g-gundam Thanks, that's nice! It is indeed not so stimulating, when taking time to investigate things (I am no Doom user) and then (probably correctly) explain how things work, to subsequently get downvoted. But luckily this seems to be an exception. Thanks again for the bump! Jan 31, 2023 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.