Open tmalsburg opened 7 years ago
Glad you like it! I had the same reaction when I first discovered vim-lion.
Regarding the mode - at this point, I've spent (at least) twice as much time on figuring out how to package this functionality for evil versus time I've spent developing it.
Different people use evil differently - some use it for prog/text modes only, some use it everywhere, some use emacs-state instead of insert-state.
Looking at different packages, I don't see a single convention that evil-lion can follow:
Trying to package evil-lion as a mode has its quirks as well - now it's a global minor mode, but doesn't have a local mode companion (as a result you can't enable the local mode in a prog-mode
hook); this is easily fixed by defining it as a local mode and using emacs' define-globalized-minor-mode
, but then it doesn't work for fresh buffers in fundamental mode (created with :new
for example) as described in the docs
My goals seem so simple (to me at least), yet I haven't found a way to cover them all in a clean fashion:
(evil-lion-mode)
tries to achieve; I guess most of the users will just add this and be done with itga
instead of gl
)In other words, I'm more than open for suggestions.
Hi, please allow me to chime in.
at it's core, evil-lion is composed of just 2 commands. to use evil-lion, the user just have to bind those commands to convenient keybindings.
So turning off evil-lion should be just a matter of unbinding those keys. the minor mode does just that: binds and unbinds the default keybindings.
I find this simple and effective enough. "just works".
Yes, it's easy but not having to think about switching evil-lion on would be even easier.
Yes, it's easy to switch on evil-lion-mode but it's not "just works" easy. That would be if the user didn't have to bother at all about activating evil-lion. Anyway, it's not a big deal and I see now that this issue may be a bit more complex than I appreciated. Probably best to stick with the current approach.
Here's yet another way you can bind the 2 commands with the added benefit of autoloading evil-lion on first use:
(use-package evil-lion
:ensure t
:bind (:map evil-normal-state-map
("g l " . evil-lion-left)
("g L " . evil-lion-right)
:map evil-visual-state-map
("g l " . evil-lion-left)
("g L " . evil-lion-right))
I believe this could be made even shorter with general.el
With this approach you never have to enable the minor mode. But it has the drawback of being active in non prog-mode buffers like magit.
I'll leave this issue open for a bit, just in case someone comes up with some other option.
This is such a great feature. One of those things that you've always missed without knowing it. One question, though: Does it make sense that this has it's own mode? I would guess that users want this when evil mode is on but not otherwise. Making this its own mode means that it can be switched on with evil off and the reverse. Not sure if there are any use cases for these combinations.