reddit / emacs

Vim Clutch for Emacs?

gammarray · 2022-02-04 03:38
I’m considering getting a foot pedal as a “clutch” for modal editing in Emacs. Does anyone have a recommendations?
[deleted] · 2022-02-04 03:57
I think that modifier keys being held on a keyboard emulated by a microcontroller won't fire off in conjunction with keys on the main keyboard. I think some custom circuit design wired onto the keyboard might be requiered to make it work. ​ The vim clutch has the advantage of only needing to send a single keypress. I've seen other pedal accesories that explicitly stated that modifier keys were not functional.
shizzy0 · 2022-02-04 04:43
I've done it. But I did it with a custom board. I grabbed this [foot pedal](https://www.amazon.com/gp/product/B07WNGQQ67/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&th=1) and [adapter](https://www.amazon.com/gp/product/B08KW24ZV9/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1) and then added it to the [dactyl keyboard](https://github.com/adereth/dactyl-keyboard) I built with a 3.5mm jack and stuck it in the keyboard matrix that wasn't using a key. If you're looking for off the shelf, the kinesis advantage has a foot pedal option. This crazy cool [Glove80](https://www.kickstarter.com/projects/moergo/glove80-the-incredibly-comfortable-ergonomic-keyboard?ref=user_menu) exposes some GPIO pins to make the addition of a foot pedal very easy. I hope more keyboards will consider doing that. I'd check out r/mechanicalkeyboards and see if there's something there you'd be interested in building. Any keyboard that has open source firmware QMK or ZMK will let you add a foot pedal pretty easily. I handwired mine, but even with a PCB you can just solder some wires onto it to add a 3.5mm jack and boom, the foot pedal is just a big Cherry MX switch.
KuangPoulp · 2022-02-04 07:14
Why link it to the keyboard when you can just use something like Autohotkey to translate the pedal input to anything you like?
Imaltont · 2022-02-04 07:25
I would imagine something like that would be possible to program in a QMK compatible keyboard/device.
gulpgaming · 2022-02-04 07:36
Hell yeah! When you do it, stick big "ESC", "V", or what you're going to bind it to, on the pedal, and post it oh r/unixporn xd Would love to see how it turns out
patrick_thomson · 2022-02-04 11:20
This is true, but it can be worked around with software solutions given a window server that supports event taps. I wrote something that does this for macOS (https://github.com/patrickt/centripedal) and I’m fairly sure the approach would scale to X or Win32. It’s enabled me to use my Kinesis pedal with my Keymacs keyboard.
shizzy0 · 2022-02-04 12:06
Some keys like escape would work fine for that. Modifier keys likely would not work the way you suggest, and mod keys on the keyboard would not affect it.
rese2020 · 2022-02-04 12:29
why not [evil-escape](https://github.com/syl20bnr/evil-escape) instead of a clutch? it is quite fast or it is just a personal preference?
gammarray · 2022-02-04 12:32
I’m mostly just looking for a single key to toggle modal editing, but I could also see a multi-pedal option where I would also want modifiers. When I use modifiers on my laptop keyboard at the same time as pressing keys on my dactyl, it “just works”. I wonder if the same would be true for pedals? I’m running Emacs with EXWM on NixOS.
gammarray · 2022-02-04 12:41
I already use a [key sequence](https://github.com/vlevit/key-seq.el) for toggling. I want to go to the next level, remove the extra step, and have a fluid experience at the keyboard.
J-ky · 2022-02-04 15:36
I remember reading an article about using a foot pedal as control key in the past. The author said the coordination between foot and finger was extremely hard, even if he got some practices, the speed was never as fast as finger on keyboard.
easter_islander · 2022-02-04 16:16
That would be my assumption too. I can't believe I'd find it helpful at all. But reaching far from home to `Esc` is always one of my dislikes with the vi interface. I always thought if I was tempted back I'd train myself to use `C-[` which is much less disruptive to me.
riksolo · 2022-02-05 00:13
Assuming a normal-ish keyboard layout, i can strongly recommend swapping your capslock and escape keys. I have this programmed to my (qmk) keyboard, but most OS's have ways to do it on a system-wide software level as well. I use escape significantly more than caps, and it's definitely changed my life by bringing escape to the home row.
easter_islander · 2022-02-05 01:12
Capslock is already Ctrl for me. Pretty much always has been. My first keyboards had it there.
thetemp_ · 2022-02-05 03:09
I have one of [these](https://www.amazon.com/gp/product/B089DDMKYW/), though I hardly ever use it. You can program it to act as an Esc, Ctrl, Alt, whatever. Right now I have it set to act as a Ctrl key. As I type this, I'm able to hold the pedal with my foot and do cursor movements using the f, b, n, and p keys on a separate USB keyboard. Both devices are connected directly to the computer. I don't know if this works just because of how Linux works or if it would work the same way on Windows too. [This project](https://github.com/rgerganov/footswitch) makes it possible to program the device from Linux.
phalp · 2022-02-05 13:03
Consider doing it as a knee lever, it's very ergonomic that way.
gammarray · 2022-02-05 15:54
Lol, idk if that applies to standing desks.
riksolo · 2022-02-06 10:27
Fair enough. I have mine set to be control on hold and escape on tap, but that might be a bit hard to do without a QMK keyboard
phalp · 2022-02-06 19:19
Yeah, I've got a standing desk but haven't tried any lever stuff since I set it up. I think it could work though. You'd just position it so your thigh pressed against it when you lifted your heel or shifted your weight forward.