cover_beginner · 2022-02-19 05:03
I was looking around for comparisons between the two but they seem pretty similar. Anyone have a preference for one or the other? I've been looking for a good evil-leader replacement after learning it's been deprecated
EDIT: I'm mainly looking to replicate the `<SPC><character>` functionality that spacemacs has but with the snappiest (good performance) package
OgdenWebb · 2022-02-19 06:09
They are pretty different in a nutshell.
TL;DR: General is your choice here, especially for an evil user. But you can you use both at the same time if you want to.
General.el - let's call it a meta-package which allows you to manage all your keybindings based on keymaps, evil states, it provides you a bunch of macros to create new keybidings, it also contains some extra functionality (such as ghook, gset, use-package and which-key integration and etc) to simplify your configuration. General.el is a powerful framework for keybidings, also you can treat this package as a use-package for mapping.
On the other hand Hydra package first of all was created to generate useful UI menus based on keybidings.
7890yuiop · 2022-02-19 11:32
> they seem pretty similar
In what way(s) do they seem similar?
cover_beginner · 2022-02-19 16:44
I'm looking into rebuilding my config from scratch coming from Spacemacs with vim mode before and I was looking into re-implementing the leader key functionality. In terms of being able to press `<SPC><other-characters>` it seems like both `general` and `hydra` offer that functionality so I'm not sure which is better.
`hydra` seems to have more github stars but I've seen `general` recommended for Evil users but without much explanation why
7890yuiop · 2022-02-19 19:52
You don't need any extra packages at all to be able to use `SPC` as a prefix binding.
(define-key KEYMAP (kbd "SPC x") #'my-command)
Hydra is for visual key-based menus. General is a wrapper around `define-key` AFAIK.
Starlight100 · 2022-02-19 21:44
I'm not familiar with general, but it may not be the same thing as hyrda.
Hydra creates a temporary vim-like state where you can run commands with single letter keys.
It's like vim, but instead of only 1 normal mode you get infinite. It solves the problem of not enough keys on a keyboard. You can have set of 1 letter keybinds for each situation. You might set up a hydra for navigating and resolving merge conflicts with smerge.
cover_beginner · 2022-02-21 02:37
D'oh. You're completely right, I could have done this without any extra packages.
cover_beginner · 2022-02-21 02:56
I suppose the downside here is that the command may trigger when I'm in "insert" mode of evil and I'm typing in normal sentences rather than wanting to execute `'my-command` and that's where general or hydra start to shine
7890yuiop · 2022-02-21 06:19
The command could only trigger if the keymap in question was active. If you don't want it to happen in "insert" mode of evil, you would arrange for your keymap to not be active in that situation.
I'm sure general streamlines certain things, and hydra certainly offers a visual approach that regular keybindings on their own do not provide; but most Emacs interaction ultimately *does* come down to regular key bindings, and behind the scenes I don't expect those libraries are any different.
Use them if they're useful, by all means -- I'm not suggesting you shouldn't. I'm just saying that everything they do can be done without them (and necessarily so, because neither of them are a standard part of Emacs, so they are both using standard Emacs functionality to implement all of their features). They may certainly make things simpler, though.