Vim is the greatest or the worst text editor of all time, depending on the tribe you’re in. Either way, members of both camps can appreciate this build from [Chris Price], which uses a foot pedal to ease operations for the user.
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. In the Vim world, it’s referred to as a “Vim clutch.”
The build used a cheap pedal switch sourced from eBay, into which a Raspberry Pi Pico was installed. The Pico was hooked up to the switch contacts, and programmed to act as a USB HID device. When the pedal is pressed down, the Pico sends an “i” keypress to enter Vim’s insert mode. Releasing the pedal has the Pico send a “ESC” keypress to return to normal mode.
Those that use Vim on a regular basis would likely appreciate the productivity improvements of such a device. Plus, there’s some ergonomic benefits to not having to strain one’s hand over to reach the ESC key. Of course, it’s an old-school solution, but there’s still something so compelling and next-level about having a foot pedal hooked up to one’s dev rig.
But sometimes you want to ‘a’ppend and quite often to ‘A’ppend or simply ‘c’hange and ‘I’nsert. And then to ‘o’ on the next line. And programming loves … repeats.
You need a foot-key board to cover your tracks.
Yeah, this is kinda a bandaid. Holistically, it would probably just be better to treat it as “esc” and use the regular motions to enter insert mode. They’re mapped to accessible letter keys for a reason.
I can’t remember where but I have seen a four way foot pedal (Down, Up, Left and Right). I think it was part of a DIY accessibility mouse setup.
The footmouse was forever doomed by it’s original name. The rat.
I already have unused buttons on the side of my mouse. Thumb is already there.
I miss my foot pedals.
I had a TRS-80 Model I, and added an Omikron Mapper that came bundled with CP/M and WordStar. Difficulty: the Model I keyboard had no Control key — so the driver mapped up-arrow to Control. THAT, with the high position and high and harsh key action, gave me wrist pain almost instantly.
I added a pair of audio jacks wired to the connectors for the up-arrow and Shift keys, and plugged in a pair of cheap foot switches that Radio Shack stocked at the time. Stomp-K-S, baby!
One Of These Days I’ll dig those pedals out and build a little USB box to use them with my current machines…
Sooooo basically you are telling the world you are a vim user that uses a mouse….🤔 Tell us more 🤣 Buddy, The point of Vim is LITERALLY to NOT have to take your hands (or feet) off the keyboard. #YouHadOneJob 🤦🏿♂️🤷🏾♂️
YOU EDIT WITH YOUR FEET ON THE KEYBOARD?!
I have enough unused keyboards around here that I could use one of them, build a barrier over the other keys and put a small extension on the needed key.
100% footpedal
yow! i’m a third tribe — vim is awful, because nvi (roughly, BSD vi) is much better. and this article illustrates an attitude that seems pretty ridiculous to me. but, i mean, use whatever you use, i don’t care. there’s nothing more personal. but why someone would want to suffer the downsides of vi without any of its upsides is really beyond me. i know people who use vi out of inertia (people who learned vi before non-modal screen editors proliferated), even though they don’t take advantage of it the way i do…which makes a lot of sense but the last thing that group would want is to learn a novel input device.
i use ‘i’, ‘a’, ‘I’, ‘A’, ‘O’, ‘s’, ‘c’ with about equal frequency, and ‘r’ and ‘S’ pretty often too. it’s fair to suggest the editor has “two modes” but how you enter the edit mode is of crucial importance. each one of these edit operations can become an atomic interaction, which you can undo/redo with ‘u’ or ‘.’, or which you can script. i use ‘:map e .n’ for example, and that’s only really effective if you’re particular about the operation that you’re repeating. usually for me it’s something like ‘c3labc^[‘. it’s enormously powerful, it’s basically my first resort on the spectrum of nvi -> sed -> awk -> perl for one-off text processing hacks.
the biggest reason i personally prefer nvi over vim is that it has a superior (and apparently unique) meaning for ‘u’ and ‘.’. vim has two modes for it (one of which is compatibility with sunos vi), and i don’t like either of them and they aren’t as powerful.
the biggest reason i consider vim bad as more than just a matter of personal taste is that it’s O(n^2) in basic operations. consider the case of making a 4MB text file just for test purposes. obviously there are a bunch of tools but nvi is usually the tool already in my hand so i type ‘1000000ablah^[‘. less than a second later, i have my file. try it in vim! with a repeat count of 1000, it takes about a second on my PC. with a repeat count of 10000, it takes more than a minute! 1000000 would take days.
i assume this is a side effect of how the undo stack is implemented…adding insult to the injury that the undo stack isn’t as featureful. i rarely need to repeat an operation more than 1000x but sometimes i do, and i do it without thinking, and nvi never crashes. the arbitrary limitation really bums me out.
You’re not a 3rd tribe, you’re 6 Standard Deviations from the mean!
B^)
Edlin forever!
Ed is the standard text editor.
https://www.gnu.org/fun/jokes/ed-msg.en.html
It’s actually funny how ed is in reality requirement for critical parts of GNU/Linux build stack considering how dead the project upstream is.
Pshhh ed you youngins and your fancy text editors, why back in my day we used qed and we was better for it I tell you what :).
qed, luxury.
text editing:
copy con: filename.txt
programming
copy con: filename.exe (use alt keypad)
I am confused when I meet somebody who hasn’t remapped caps lock. Such a RARELY used key, such good real estate. That key should be way over by sysreq or something. A lot of people put ctrl there, but I think it’s better to train oneself to palm-press ctrl
I am confused when programmers tell me they use shift (sometimes even alternating it between hands) to type out LONG_CAPS_VARIABLE_NAMES and such. I agree that it’s more rarely used but I would feel hopelessly handicapped without it. Maybe I should swap caps and escape at some point, but I fear having to type on other’s keyboards…
This is essentially a non-issue for me. My neflexes associate layout with the keyboard in question so when I type on another keyboard they go back to “default”.
Temporarily remapping my own keyboard gives me problems though.
I say keep it but not in the home row. And yeah when I type on other people’s boards I have to shift gears. It gets manageable with a little practice
Well, Emacs users can always just type the name in lower case, then go back and hit the upper-case word command a few times. Or they can mark the start and do upper-case region at the end. But really, I have no problems holding down shift to type. I find I use my left pinky to hold down shift, and I if I need to type Q/A/Z I use my ring finger.
The problem of typing on multiple keyboards is definitely an issue. I really miss CapsLock mapped to Control when using other people’s keyboards, but it’s not usually a big issue.
if you’re writing in vim anyway, just type the name in lowercase and use vbU – no need for shift or caps lock
I Just use gUiW
Well, once in a century occasions like when you have to type a capitalized name that’s not filled in by your IDE or covered by a well crafted shortcut is what the shift+caps lock override in the remapping is for.
i strongly agree but of course to each his own. i use dvorak, and capslock remapped to control.
people are saying it’s hard to switch keyboards…and that’s also of course a really personal problem. me, i don’t use other people’s keyboards that often, and when i do, it’s not for a long time…so it’s just not an issue, even if i have to resort to hunt-and-peck for 5 minutes out of a day it’s not a big deal. i mean, it’s probably already awkward as heck because i’m like reaching across my buddy’s body to use his keyboard.
the time i run into it is when i’m like installing or booting up single user or whatever…you know, when the computer is broken. and it is a little nuissance, like, i’m fighting with grub for a minute but it’s not like i’m typing a novel. and in that minute, i’ll accidentally toggle capslock a few times. *shrug*
if my job put me on other people’s computers or managing fresh installs all the time or something, i would have different habits. honestly, i’d probably do the same thing, but i’d learn to get better at switching. in highschool i could switch dvorakqwerty without much stress, because every day it was qwerty at school. it really is pretty amazing what you can train the reflex part of your mind to, if you’re willing to suffer through about a week of keyboard-confusion.
Personally, I remapped the sequence “fj” to ESC. There are a minimal number of English words with that sequence, and the keys are right under the each index finger.
Re-mappings Caps lock to Escape is so much easier! It annoys people that try to use my computer, but it’s not as bad as the Dvorak guys…
Haha, I was thinking about making exactly that a bit ago. Glad someone else beat me to it :’)
Although, I would’ve just kept it to pressing “ESC” instead of also pressing “i” on release.
https://www.delcomproducts.com/productdetails.asp?PartNumber=703600
Just. Use. Nano.
What’s amusing is that Pico is another “simplified” editor for Unix that predates Nano. So this person is using Pico to drive Vim…
Pico.came with Pine. When the University of Washington released the software, Pine became Alpine, and Pico became Nano. Functionally the same.
When I first installed Linux, I added Joe. Depending on how it’s invoked, it takes on other editors like Wordstar.
yeah! i’m always surprised the war seems to be between vi (which is a weird thing) and emacs (which is fantastically bloated). i sometimes wonder if there aren’t people using vi today simply because they don’t want to use something as bloated as emacs! seems crazy that people would be forced into something so esoteric just because they don’t like bloat.
but editors like joe (or pico/nano) exist and are totally a reasonable option…the non-vi world is not simply emacs. i came from VDE.COM on DOS and joe was a natural fit for me.
The thing with Vim type stuff is it is more than just a text editior – it has way way more features than something like nano, that if you actually get familiar with using it can greatly increase your productivity.
Nothing wrong with nano (etc), for 99% of most peoples text editing jobs it is as good as anything else I expect. But if you do use even a few of the powerful features of Vi enough to get comfortable with them it is hard to go back – just the keeping the hands on the homerow and having the navigation controls and delete whole words imeediately is so handy and quick compared to nano (and the like) when editing those few settings in a config file (until you start to forget how to really use Vi again though lack of use)…
How many tribes are there?
I use Pico/Nano, sublime text and emacs.
Tribes are getting smaller as the churn approaches.
I ran into this issue 30 years ago w/ an IBM AIX (IBM’s version of UNIX) computer using a PC keyboard. My solution, which I still use to this day, was to remap the ` key to ESC, Shift+` to `, Backspace to Backspace, and Shift+Backspace to ~, along with CapsLock to Control.
Ctl+left bracket = Esc
This is the comment I was looking for. This is the proper way to do ESC (hopefully you’ve already swapped ctrl and caps lock, right?).
You can use the arrow keys now in vim… Much less use of esc…
You can try swapping escape and caps setxkbmap -option caps:swapescape
I use a 3-pedal foot pedal meant for transcription. You can find them on FleaBay for $20. Stock, it plugs into USB and Windows/Linux see it as an HID device but I was unable to get Windows/Linux to translate that into useful keystrokes. So I ripped out the stock controller and replaced it with a clone Arduino Pro Micro AT324U (cheaper and smaller than Pi Pico). Programmed it to send F22, F23, and F24, then use AutoHotKey to map that to keystrokes appropriate to whatever application has focus. For many apps, I use the left pedal for copy, right pedal for paste. Or back and fwd for the browser.
Tell us the truth… they bought a MacBook with the ESC key on the OLDE bar, right? 😂
Also: in many dotfiles I’ve seen, people remap ESC to insert mode jj, so… 😅
I think I will just remap my caps lock key to act as escape. Wouldn’t that be better? Caps lock key has got to be the least used key that is the closest to the left pinky.
I once tried a foot pedal (switch) as a computer interface addition, only to find I move my feet too much and don’t have it near the pedal when I need it. Unless I sit still in a unnatural manner, which is sort of beating the purpose in my view, and will probably not be healthy either.
Multiple extra mouse keys is a better way, unless you need a linear type input like with driving games, but that’s another kind of pedal.
Or, if you are the type, you can use a voice interface I guess, a single ‘toggle’ voice command is doable, doesn’t need a lot of chatting nor a server in a data-center to achieve.
One reply remark to Doctor Wizard: The AT324U has not been cheaper than a pico for quite some time now, the chip shortage apparently means all those clones are not as budget as once.
I use a cheap three pedals device daily. Not for vim, though. I use it for left/right/down. Combined with previous \ next on my mouse, I avoid using the scrollwheel and the keyboard and it makes reading a breeze. Had to install the drivers from the wayback machine, though. And that was several years ago.
I’m about to get way too dependent on pedals brb lol
I just imap ‘kj’ to and then you don’t even have to leave the home row. No clutch needed.
I want to do this for scrolling for a few years now. Hopefully one day…
Pretty common to map ESC to jj or jk these days so so don’t have to leave home row to jump in and out of insert mode
The featured hack is cool, but you can also use Ctrl-[ instead of Escape. They’re equivalent on every terminal I’ve ever used.
I had a similar idea (for some pedals from an old force feedback steering wheel) but for sudo. Press the gas, the terminal in focus goes red background and whatever commands entered happen as root!
Never got around to implementing that though.