reddit / emacs

Anyone tried a heavily customized key-map for evil mode?

ideasman_42 · 2022-04-26 12:22
I was looking to use an alternative layout for evil mode keys (remapping most keys except for symbols), favoring more logical groupings & placement over VIM's mnemonics. While I've have this working well enough to be usable, getting this working _properly_ is quite involved given the number of key-maps there are which are layered on top of each other. Currently I'm clearly the key-maps and re-populating them to avoid accidentally using existing key-map entries, but there are quite a few keys to map. Has anyone managed a comprehensive remapping of evil-mode keys before? Any suggestions for an approach that works well?
redguardtoo · 2022-04-26 14:25
Most commands are rarely used so they are not worth the time to re-map keybindings, I use `keyfreq` to collect the statistics to reach this solution, see https://blog.binchen.org/posts/how-to-be-extremely-efficient-in-emacs.html
hamnixster · 2022-04-26 15:26
Have you seen [Meow](https://github.com/meow-edit/meow)?
[deleted] · 2022-04-26 17:05
[deleted]
_noctuid · 2022-04-26 18:58
I see no point in mapping things entirely around frequency of use rather than mnemonics. There's hardly any difference between the different home row keys and other easily accessible keys. That said, I do make a ton of changes. The most used commands get single key keybindings in good positions (e.g. qwerty Y is a bad position). Less used commands go on a prefix key. My keybindings end up being very different from the defaults, but I don't clear any keymaps. I agree with redguardtoo. Even if you want to throw out mnemonics, do you really need to change *everything*?
ideasman_42 · 2022-04-26 22:40
While I don't change *everything*, I'm easily changing over half the keys. Part of my initial motivation to do this was to allow moving to a different layout entirely (WORKMAN) for e.g. while keeping well placed HJKL style motion keys & without having either hard to remember locations (that no longer match their mnemonics or use new ones which wouldn't be an exact fit when mapped to NEOL). With the system I'm working on, I can set keys up to be mapped by physical location, then have settings for QWERTY, COLMAK, WORKMAN... etc. As I find the locations themselves memorable, I no longer need the mnemonics.
ideasman_42 · 2022-04-26 22:44
Yes, I was interested to take the plunge with Meow, but they miss some (what I would consider) fundamental features such as jumping to the matching bracket, redo key in the key-map... when asked they kindly responded that Meow is light weight and that I could add this functionality myself. While I don't mean to criticize this approach - it does make it hard to evaluate the system out of the box as a replacement for evil-mode. I'm aware this could be an unfair conclusion to come to - perhaps these issues are not so important and I could overlook them. Nevertheless, learning a new modal editor is a massive time investment, so I want to be sure the authors have thought of my needs beforehand instead of making it my responsibility to add - what is arguably fairly basic functionality.
_noctuid · 2022-04-26 23:58
I am also using an entirely different layout (colemak-DH), but I think by letter for everything besides the hjkl (actually mjkl for me) positions. When I've switched layouts in the past, I've switched for everything including vim/evil keybindings. I'd do that again personally and just relearn the positions. You already have to relearn them for typing. I can't imagine the effort to rewrite all my configuration files to be based on keyboard position.
mmarshall540 · 2022-04-27 19:46
\> jumping to the matching bracket Isn't this the same as backward-sexp and forward-sexp? (But I suppose those wouldn't work with point inside of the brackets, if that's what you want.) \> redo key And isn't this the same as the built-in repeat command? You might want to give Meow another look, as its approach seems like it would be more in line with heavily customized bindings. They don't have default bindings per se, but they provide "suggested" bindings on the Github page. Which I guess supports your point but also your objective. It would be trivial to take one of their suggested maps and alter it as you see fit. I gave up on modal editing a while back, but from what I remember about Meow, it did a very good job of integrating with Emacs's conventions and built-in keybindings. So the problem of context switching was greatly reduced. With evil-mode, even if you don't customize its bindings, you have to use extra packages like evil-collection and evil-org to get consistency in different modes. Meow translates keypresses, so that when you use Meow bindings in a mode which has altered Emacs's keybindings, you're invoking the command that goes with that mode, like "org-next-heading", instead of "evil-next-paragraph" for example.
ideasman_42 · 2022-04-28 02:20
> > redo key > And isn't this the same as the built-in repeat command? No, there is undo/redo and repeat (in evil mode that uses the macro system not undo data). ---- > I gave up on modal editing a while back, but from what I remember about Meow, it did a very good job of integrating with Emacs's conventions and built-in keybindings. So the problem of context switching was greatly reduced. It's staying on my radar, so far remapped evil-mode is working well for me, but it's possible I could move my current modified evil key-map to Meow without it being all that disruptive.
mmarshall540 · 2022-04-28 17:25
\> No, there is undo/redo and repeat (in evil mode that uses the macro system not undo data). Oh, I see now. Thought you were talking about redoing the last command.