Vim Foot Pedal
hackaday.com
hackaday.com
You can do this with Karaniner Elements on macOS. There’s a way to do it on Windows too, but how escapes me at the moment.
I just have a simple autohotkey script + vim like keys for going up and down in textboxes/selection/dropdowns.
<!k::Send {Up}
<!j::Send {Down}
Capslock::Esc
Only downside is the mess that happens when on other machines that don't have that, also try to use ^[ as much as possible.It's an interesting concept. I have been using capslock as control for so long that I don't know I could get used to this though.
Works great in Windows and Linux.
I just use the good old control keys now. Either by using my palm or (more commonly for the left one) the last knuckle of my pinky finger.
I've tried modifying the Super / Win key. It would often happen that the keyboard would become unusable and behave like if it had the Win key stuck, even though it was remapped to something else.
This actually happened on Windows 11, not 10 (never tried on that). I don't know if it makes a difference.
Though, I'd encourage a custom keyboard where the thumb can reach 2-3 keys each (instead of only really being able to hit the spacebar). That way, you can put Esc on a thumb key. -- e.g. ZSA's moonlander or planck ez are nice.
Makes zero sense ergonomically to put the CTRL key on the home row.
I tried it for about 0.05 seconds and after pressing CTRL+Z one time I knew it was not a good idea for me. pinky finger does not like pressing a key while being on a higher row than another finger also pressing a key. painful.
I remapped capslock to delete, and shift-capslock to capslock for the rare occasion I want to yell at my future self.
That way I can use the "control" key on the opposite side of the alpha key, the same way one is meant to do with the shift key when touch typing.
Maybe it’s decades of doing it, and I don’t consider myself especially dexterous, but I never have any problem with it.
I don't think pedals bring any significant ergonomic benefit, but pedal setups look cool nonetheless.
Swapping keys isn't interesting and you can't write a blog post about it.
"Some", sure, but "most"? Not so sure about that.
Besides, everyone knows what Ctrl is the One True Key™ in place of the Caps Lock and that only degenerate infidels map it to anything else.
Of course now you have to call your file descriptor something else. No free lunches.
I like it because my fingers never leave the home row.
Haha yeah I've heard about that and I like the joke =) But I was never interested in adopting it. Because I configure my alt keys to act as ctrl keys which imo results in a much more ergonomic setup.
Ctrl is the most pressed control key for people like me who live in the terminal. But the default placement of the ctrl keys in modern layouts is so wrong. I have never understood it. I guess there has to be a historical reason but I've yet to find out. (Help me, greybeards)
I should't have to move my hand and strain my pinky to reach out the most pressed control keys. With alt it's so much easier. I don't have to move my hands nor use my pinkies. My thumbs already rest on the spacebar and I just have to make a little thumb movement.
Swapping ctrl with caps lock is an ok remedy but alt keys are in a much better place.
So ctrl goes where alt is by default.
But do I swap ctrl with alt? No!! Alt is a frequently used key as well so the default ctrl keys aren't a good fit for alt either. Instead I set the keys immediately adjacent to the default alt keys to act as alt. It's the Super key (sometimes referred as the "Windows" key) on the left side and the context menu key on the right.
Lastly, I set the default left ctrl key to act as Super and the right ctrl key to act as context. Because I virtually never use those.
(I think Apple got this mostly right. cmd is the most used control key for the average Apple user, and opt is next. Their placements are perfect. Though it's still problematic for developers as ctrl is again at the worst place possible. Because of that, what I do in Macs is swapping ctrl with cmd while leaving opt where they are.)
If I'm an infidel for doing this so be it. But with this setup, I'm extremely efficient one. I type and code and enter & exit from repls and jump between interfaces like a damn machine, impressing mostly everybody who watch me use my computer.
Ergonomics FTW
I've seen this talk here and the speaker mentioned the ADM-3A (that is also mentioned in the article itself) terminals at about the 17/18 minute mark. Mind the keyboard layout :)
https://jackrusher.com/strange-loop-2022/ https://en.m.wikipedia.org/wiki/ADM-3A
It's just what I'm used to. I grew up on the MSX which, like many keyboards of its day, had Ctrl where we now have Caps Lock. When we upgraded (well, "upgraded") to Windows 95 I found some hack to make CapsLock behave like Ctrl because I was so used to it. Later I started using Linux and BSD and of course carried over the mapping with xmodmap. I've never really known anything else than Caps Lock being Ctrl.
Another oddity from my MSX days that took me years to get rid of was that a line would only be saved if you pressed "enter" at the end of it. That is, if you were editing some file, went up a line, edited it, and then just went down a line (without pressing enter) it wouldn't actually get saved. It took me quite a long time to get rid of the habit of "End + Enter" to make sure the line got saved (which wasn't needed on any other system I've used).
Japanese keyboards have extra keys near space. It's possible with software to remap those keys to something else like Ctrl. Really wish more keyboards had usable thumb keys...
Both my Ubuntu and OSX machines are setup so that just pressing Caps Lock alone = escape, and holding Caps Lock = control.
For the curious, to do this in OSX I use Karabiner + a "complex modification" (i.e. import a small JSON config). And for Ubuntu I use a few 'xcape' commands that autorun on startup.
If you don't move your hand, you'll have to stretch your fingers, and might be better suited to a minimalist keyboard with function layers.
Every ThinkPad I've had since then has been a regression in this department, beginning with the X201s and now I'm on an X230 and my typing is awful compared to the 4:3 X-series glory days. Reaching for the ESC key is noticably annoying compared to what I know so well to be the ideal. Why Lenovo kept stretching the keyboard to accommodate their widescreen transition instead of relocating better speakers to the keyboard flanks is beyond me.
But having suffered through this mess I fully understand why vi(m) users remap ESC to CAPS or pursue other mitigations. ESC key access is highly sensitive to keyboard-size:hand-size, and I suspect for many it's just inconveniently distant like my X230 is for me.
The basic concept was to use a pedal to enable switching between normal and insert modes. In Vim’s predecessor, vi, switching modes was easy, with the ESC key located neatly by the Q on the keyboard of the ADM-3A terminal. On modern keyboards, though, it’s a pain, and so a foot pedal is a desirable solution.
So let me get this straight... it is easier to blindly grope for a foot pedal somewhere under a desk than it is to hit that very visible, very close-at-hand key on the keyboard with whatever appendage happens to be closest? Of course it isn't, this is just rationalisation for making that foot pedal - as if any reason is needed to indulge in such projects other than 'because I (want to find out if I) can'.
(And I don’t want to use Caps Lock for that, Backspace on the other corner of the keyboard is far less convenient, that’s what I want Caps Lock to be.)
Having a qmk split keyboard (the iris specifically https://keeb.io/collections/iris-split-ergonomic-keyboard) was a more lasting solution that also solved some other ergonomic issues. Now my thumbs do more than just thonk the space bar. Control, shift, space, meta, backspace/delete, enter alt and esc are now done by thumbs instead of pinkies.
More literally though, the Logidy UMI3[1] is a MIDI-over-USB foot controller that uses guitar pedal-like switches. It's designed to serve as a hardware interface to software loop control, but you can use a MIDI yoke or translator[2][3][4][5][6][7][8] to turn MIDI input into keystrokes, game input, etc.
1: https://www.logidy.com/umi3
2: Using just `aseqdump` to capture input, `xdotool` to simulate keystrokes, and a 7-line shell script to glue them together: https://superuser.com/questions/1170136/translating-midi-inp...
3: https://www.bome.com/products/mtclassic
4: http://www.varal.org/ttymidi/
6: https://hautetechnique.com/midi/midishortcut/
7: https://github.com/xobs/midi-to-keypress (Rust, Linux/macOS/Windows, open source)
8: https://charlie-roberts.com/midiStroke/, https://github.com/charlieroberts/midiStroke/ (macOS, open source)
1: https://catswhisker.xyz/log/2018/8/27/use_vecinfinity_usb_fo...
It didn't support up/down events but that was ok for me.
For me the mapping was: button 1 i3 workspace back_and_forth. button 2 exec a floating urxvt terminal. button 3 i3-lock.
Honest question: Is it that uncommon knowledge that Ctrl+[ is equivalent to ESC in vim default keybinds?
For me: annoying to use a modifier for a common key + doesn’t work on my keyboard.
It's pure muscle memory after the first week or two, is obviously faster than fumbling around for ESC (which may move slightly between keyboards).
It works on every terminal, also on every keyboard, doesn't require customisation of your vim environment (compare to remapping CAPSLOCK) which is highly preferable if you're moving between ephemeral hosts and/or hosts you don't own or can't conveniently customise.
The pairings are offset by 0100 in octal. The octal ordinal for escape is 033. 0133 maps to [ so ^[ (control-open-square-bracket) is equivalent to escape.
Some other common ones are: line feed/^J, backspace/^H, tab/^I, and end-of-transmission/^D. If you ever type “exit<enter>” to end a shell session you can do the same with ^D.
Similarly of course you don’t have keys for upper and lower case letters. You use the shift key for that, which shifts the code by 040 instead of 0100. Technically it’s down by 040 because while most keys are labelled in capitals their default behaviour is to send the lower case letter.
Yes. Also line feed/^J, form feed/^L, carriage return/^M.
And, related: anyone not knowing the basics of vi, can check out my vi quickstart tutorial below. I had first written it at the request of two Windows sysadmin friends of mine, in a company where I was working at the time. They had been given additional charge of two Unix boxes and I wrote the tutorial to enable them to hit the ground running with common sysadmin editing tasks. After reading it and using Unix for a few days, they told me that it was useful and met their need.
The tutorial is small, so it can be read soon and you can start applying it right away:
This is important and the same thing I came to post. I'm not by any means a power user, but even for me, just having i as the way to get into insert mode pretty much defeats the purpose of not having to use the keyboard, because you still need the keyboard to get the cursor where you want it.
The concept of a pedal system is cool, it would be nice to think about how it could be made more comprehensive to handle a bigger subset of mode changes.
Doubt. I simply move my hand. There is no strain.
Gross movement is not unergonomic.
2ix<c-c> inserts “x”
Also, <c-c> does not trigger InsertLeave.
Better to map caps to ctrl and build up the muscle memory to use ctr-[
If you do that you also get easy access to all those other Insert mode ctrl shortcuts.
I briefly considered a foot pedal but it seems to me that foot dexterity is far lower than finger, meaning typing ihello<esc> is FAR faster than <pedal down>hello<let go>, not to mention that pedal travel is way longer.
Of course you map esc to caps.
I do really like the idea of tapping vs. holding caps lock mentioned in another comment here, though. I could probably get used to that instead.
Using the clutch either as a full esc replacement would make more sense (send esc on tap down, send nothing on release). Or inverted, send nothing on tap down but send esc on release, and have the user train that they subconciously tap the foot down upon entering insert mode by any means.
I personally use a home-row combo as escape, by pressing down the left index and ring finger at the same time.
It’s really changed the way I think about input methods. Pedals have always been a thing, but primarily for effects, not part of inputting notes. Those lazy knees weren’t doing anything!!
> ... what better way to show my appreciation to an infrequent Vim user, than to add another rarely useful peripheral to their bag!
> ... As much as I built the pedal for a joke, I can’t deny that there is something very satisfying about using it.
Personally I have remapped caps to ESC system wide and it’s a pleasure to work with
I am almost always using one of the following instead:
- o: open new line below current line
- O: open new line above current line
- I: insert at beginning of current line
- A: append to end of current line
- cc: change current line
- C: change to end of line
- ci(: change in current parenthesis
- ci": change in double quotes
- ctX: change to character X
- cfX: change to found character X
Each of these will perform an action and leave you in insert mode after the action. Then using `.` you can repeat both the changing action and the insert, all in one keystroke. Obviously impossible to do if you only use `i` and `a`.
Vim is not about toggling modes. Vim is an entire language to express text transformation, that you can then repeat with `.`, or undo with "micro commits" to your file, traversing the history back and forward in sensible chunks instead of the usual chaos of Ctrl-Z in other editors. (You can even branch your undo history!)
Most novice vim users.
Crtl and alt. Caps as escape..