reddit / emacs

solution to dreaded emacs pinky finger problem (may not be possible) (only works with evil)

[deleted] · 2022-04-18 16:12
The goal is to make **C-x <key>** and **C-x C-<key>** keybindings more accessible since they offer a lot of possible and useful commands, but unfortunately, keybinding itself is uncomfortable for a lot of people using standard keyboards. My solution is (in evil normal mode): Pressing **<space>** and then **<key>** acts as **C-x <key>** . implementing this is really simple: ` (define-key evil-normal-state-map (kbd "SPC") (general-simulate-key "C-x")) ` Note: I'm using general.el package for convenience, if you know how to do the same with built-in functionality, leave a comment. Unfortunately there is still a lot of **C-x C-<key>** type of keybindings, which you still need to reach for control key after pressing space. Solution might be: while holding **<space>** press **<key>** acts same as **C-x C-<key>**. Examples: **<space>-s** == **C-x C-s** **<space> s** == **C-x s** **<space>-k-a** == **C-x C-k C-a** **<space>-k a** == **C-x C-k a** **<space>-q-w e <space>-r t y** == **C-x C-q C-w e C-r t y** If there is some kind of method or hack to check if **<space>** is held, this solution becomes possible, making imo emacs a lot less painful to use.
donttrustthename3 · 2022-04-18 20:55
Sorry for not contributing anything directly to what you wrote out and specify, but I would like to share... Change caps lock to left control and never look back
Twoixm · 2022-04-18 21:15
On mac I can highly recommend karabiner-Elements for rebinding keys. I’m using an advanced key configuration that makes caps become ctrl if it’s pressed with another key, while pressing and releasing caps instead becomes esc, which is really useful for vim controls. It takes some getting used to but after a while it becomes second nature and I am glad to say the caps lock key is now my most used key.
jacmoe · 2022-04-18 21:54
Clever idea :) I use [https://github.com/jyp/boon](https://github.com/jyp/boon) which has changed my life. Using it with Doom-Emacs, with Evil off. It works really well with standard Emacs keybindings. Take a look at what it does for ideas, maybe? Or, switch to it.
Camel-Bulky · 2022-04-18 22:23
I just press right control with right thumb and C, X, etc - with left hand. Very comfortable and guaranteed protection from RSI.
heathm55 · 2022-04-19 02:13
This is the way. I don't even have a caps lock mapped on my keyboard anymore ... Useless key.
organic-bookworm · 2022-04-19 06:32
>if you know how to do the same with built-in functionality, leave a comment. (define-key evil-normal-state-map (kbd "SPC") ctl-x-map) By the way, Emacs 29.0.50 says `define-key` is legacy and recommends using `keymap-set` and friends instead.
kamui78 · 2022-04-19 08:44
For my workflow, I make it useful by binding it to Escape and Control with interception tools and dual-key-function plugin. This way a tap on CapsLock is Escape while keeping pressed is Control.
vifon · 2022-04-19 09:07
Do you have a source for `define-key` being considered legacy? I tried looking it up but found nothing. EDIT: Got it! [link](https://github.com/emacs-mirror/emacs/blob/d168decab4a03cd48b8b96257c36ffa575c720e6/src/keymap.c#L1075=) Quite surprising, considering the "new" API ([quotation marks are their](https://github.com/emacs-mirror/emacs/blob/d168decab4a03cd48b8b96257c36ffa575c720e6/lisp/keymap.el#L22=)) doesn't even exist in any released Emacs.
heathm55 · 2022-04-19 13:03
I've done the same with QMK firmware on my custom built keyboard, they have a feature referred to as 'tap-dancing' that sounds the same.
kamui78 · 2022-04-19 13:29
Ah, that is even better. My keyboard does not support QMK firmware, otherwise I would have done the same thing.
hamnixster · 2022-04-19 15:31
I [found this cool mode in this cool emacs config a few years ago](https://github.com/cute-jumper/.emacs.d/blob/master/modules/qjp-leader-mode.el), adapted it to a [rough version for myself](https://github.com/hamnixster/ft-leader), and now I'm using a [new version that is not yet totally polished](https://github.com/omnistegan/.rational-emacs/blob/master/lisp/ft-leader.el). The plan was to work that final version into something I can publish, and it's getting close, it's my daily driver now. [My keyboard layout](https://configure.zsa.io/ergodox-ez/layouts/jOdj7/latest/0) uses a couple of `F18` keys as global leaders, but I used to use `space` in normal mode without an issue. The basic system is a little different than you described, in `ft-leader`, by default each key works as if it was preceded by `C-`, i.e. `<leader> x` is `C-x`. Longer commands assume a `C-` going into a nested map (like the `C-x` map) i.e. `<leader> x f` is `C-x C-f`. To enter a `C-x f`, the leader (or some other configured key) is used again to modify the modifier used in the nested map, i.e. `<leader> x <leader> f` is `C-x f`. Similarly, other mods can be defined, i.e. I use `m` for `M-x`, i.e. `<leader> m x` is `M-x` and `<leader> x m x` is `C-x M-x`. I just wanted to make sure I shared all this because it looks like we had similar lines of thought. If you actually want to try one of these, I would steal my latest version and see if it works for you, but I made some bad hacks I haven't gone back to fix yet that means `exwm` must be loaded. Thinking I should get off my butt and put this together in a usable state... In any case, let me know if you have any questions!
[deleted] · 2022-04-19 15:41
>Clever idea :) tnx >I use https://github.com/jyp/boon which has changed my life. I tried it, and imo, boon was really awkward to use for me, no offense. But, thanks for your comment, i discovered there are more projects that try to improve emacs ergonomics, like boon, and discovered something that i really like. https://github.com/meow-edit/meow i dunno why, but it just instantly snapped and felt natural to me :D
jacmoe · 2022-04-19 16:43
That's great! I tried God-mode, Modalka, even Evil, but Boon was what clicked for me. I can't imagine using Emacs without it. I am glad that you found your favorite :)
organic-bookworm · 2022-04-19 16:53
>Do you have a source for `define-key` being considered legacy? >\[...\] >EDIT: Got it! link I'm at Emacs 29.0.50, so I first learned about it via `view-emacs-news` (see [NEWS](https://github.com/emacs-mirror/emacs/blob/71005decb4fb447635d7b2367104dd18bdfa64ac/etc/NEWS#L1610)), then via `describe-*` commands. The former actually says: New functions for defining and manipulating keystrokes. These all take the syntax defined by `key-valid-p`. None of the older functions have been deprecated or altered, but they are now de-emphasized in the documentation. While the latter one calls `define-key` and `lookup-key` "legacy". Also, new functions still [rely](https://github.com/emacs-mirror/emacs/blob/247e587d56f9be5164b3783e04cfba73fd667175/lisp/keymap.el#L66) on the `define-key`.
The_Great_Danish · 2022-04-20 03:54
I use https://github.com/pietroiusti/janus-key
LordOfSwines · 2022-04-22 13:35
I use a Kinesis Advantage 2. For **Ctrl** I just press one of the two **Ctrl** keys on the thumb cluster depending on the situation.I also use the following dual function keys on the thumb cluster: **Enter:** Hold **= meta** and Tap **= Enter** **Delete:** Hold = **AltGr / RightAlt** (for inserting @£$€.. etc on a Nordic layout) and Tap = **C-x** Kinesis Advantage also has arrow keys right below the home-row.
[deleted] · 2022-04-22 15:37
[deleted]