Hacker News new | past | comments | ask | show | jobs | submit login

> The default keybindings for said commands are cursed. (Seriously, C-M-@ to call isearch-query-replace-regexp ?)

BTW, this isn't only a problem with `isearch`. I suspect that other multiple-simultaneous-keypresses tend to be hard on most people's hands. Which can be bad for your typing-oriented career, and for other humans uses of hands.

Some alternatives in Emacs:

* Try to press the modifier key(s) with one hand, and the non-modifier key with the other.

* If the modifier(s) require contorting in uncomfortable ways, consider whether moving from home row is easier.

* When an Emacs key sequence includes the "Meta" modifier (`M-`), consider whether pressing and releasing the Esc key first, and then doing the remaining key/combo, is easier.

* Make a better key binding. Examples:

    (global-set-key [f5] 'call-last-kbd-macro)
    (global-set-key [f12] 'undo)
    (global-set-key [XF86Back] '(lambda ()
                                  (interactive)
                                  (other-window -1)))
* Learn fancier Emacs features which might mean not having to type this or not as often (keyboard macros is just one).

* Use or write a function or package that automates the higher-level task. For writing your own, you can learn from one of these two manuals, and just start experimenting in your running Emacs: https://www.gnu.org/software/emacs/manual/html_node/eintr/ https://www.gnu.org/software/emacs/manual/html_node/elisp/




Another option to trigger functions are vim-inspired leader key sequences such as god mode [1] and the evil leader implementations in spacemacs and doomemacs, for example [2].

[1] https://github.com/emacsorphanage/god-mode [2] https://discourse.doomemacs.org/t/what-are-leader-and-locall...


I agree with what you said, but would suggest also using the god-mode package. With that, when you hit Esc, you enter "command mode" (hit Esc again to exit it) so most keys you press will be treated as "Ctrl-<key>". So instead of holding Ctrl pressed all the time, you just hit some keys (npbfae) to move around... and search is just "s". Most vim users would just use evil-mode but for the rest of us this is a good compromise and once you get used to it, it avoids the pinkies very well.

https://github.com/emacsorphanage/god-mode


Another workaround is using sticky keys a11y features, which changes modifiers to work in sequence rather than need to be pressed simultaneously.


Personally, I'm not a fan of key-bindings of the form <modifier sequence>-<some symbol that requires a shift key>. That said, what I find intriguing about including the Transient package in Emacs is the potential for supporting menu-driven Transient interfaces to existing commands in a way that doesn't break their default behavior. Such future Transient menus could be shipped as a default and obviate the need to learn complex key bindings.


I think which-key already solves exactly that: https://github.com/justbur/emacs-which-key


> Try to press the modifier key(s) with one hand, and the non-modifier key with the other.

This is the biggest problem I see with most people’s typing: they always want to press the whole key sequence with one hand, then they complain that it hurts! :)

Maybe not enough people took a typing class in school.


This is also why keyboard layouts which don’t have Alt keys on both sides are such a menace.


Very true.


> Some alternatives in Emacs:

I swear I had to read that twice to stop seeing "alternatives to Emacs". I'll see myself out now.

(Doom Emacs is really nice though, and modal editing does help with key bindings, just as a sibling comment points out.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: