Sometimes my work-issued Macbook decides that it no longer wants to display an escape key on the touch bar (and there is no physical escape key). People joke about not knowing how to exit vi, but it turns out the game is even harder when your machine takes away your escape key!
Oh god yes. There's nothing more embarrassing than being unable to exit fullscreen powerpoint because the touch bar just won't show the ESC option because you once changed a setting about the touchbar. ESC should never permanently disappear!
Alternative to escape in vi and vi-alikes: control-[
I recommend committing this to muscle memory. It takes two fingers, but is more comfortable than reaching for escape on most keyboards.
I prefer mapping caps lock to control rather than to escape, but that's another good alternative. But in any case it's nice to have another option for quitting vim in case something terrible has happened to your escape key, as it sometimes can (sigh) on modern laptops.
Also the Alt key + letter keys produces a series of key codes prefixed by escape, so one can use any single letter normal-mode command with the Alt key, resulting in "Escape"+<key>. This is convenient to quickly switch to e.g. moving the cursor with e.g. `Alt+j` to both escape from insert mode back to normal mode _and_ move down a line.
I knew about the Ctrl+[ but this might be a game changer... I have tried vim several times but have never gotten used to the idea of staying in one mode or another (emacs chords is more intuitive to me). This seems promising.
Yes I did, and it probably wasn't really an option, but the moderators were kind enough to reclaim a very old, unused username (which I think was mine but forgot all the credentials to).
It's Stavros everywhere, it was only StavrosK here because the former was unavailable. I wasn't too fussed either way, but I asked the mods whether I could reclaim the username and they renamed the account to it, so here we are!
My point was that if there's a CTRL key on each side of the keyboard, then anything involving a ctrl+something is one-handed-able.
Whether it's good typing practice to use one hand for both the ctrl and the C, say, in a ctrl-c construct - I can't say.
I know that I rarely if ever use the right-hand control or alt keys (on a standard US-mode PC keyboard that has alt and control keys on both sides). I suspect this is poor form.
I'm curious, with a macbook do the right thing if you plug in a USB keyboard?
I'm not suggesting you just use a USB keyboard instead (although, now that I say it, that does seem like a solution).
What I'm actually wondering is how much work it would be just to create a single button that's an escape key on a USB stick that implements the USB keyboard protocol (but only ever reports that the escape key was hit).
It would depend if "Escape" requires a specific non-standardized scan code or not. (Even if it did you could also try sending the Ctrl-[ variety instead.)
Random piece of keyboard trivia: On Mac OS X (and I assume current variants) each keyboard is a separate "entity" with e.g. separate state which includes caps lock state. This means that the USB "Capslocker" gag USB dongles that randomly toggled Caps Lock state didn't actually affect Macs.)
If anyone is really looking for a single-key macropad... the Seeeduino Xiao is a small microcontroller development board which would suit the purpose. e.g. https://www.40percent.club/2020/08/wonky.html
Yes, it does. I do know that single-purpose keyboard extensions like this might be harder to integrate than you'd think. When I had my first Powerbook back in 2004, I bought a USB numeric keypad for entering grades into a spreadsheet quickly. One of the OS X upgrades in the following years rendered the keypad unrecognizable.
Yeah, I strongly considered that last time it happened. Eventually I was able to fix it by restarting a few processes related to the touchbar, and decided to leave well enough alone for fear of breaking something else. I think if it starts happening more frequently, I'll remap it.
Thankfully they gave us back the physical escape key in the next version! I had the version you're using for 3 years as a work issued machine. Between the touchbar and the butterfly keyboard repeatedly failing on me it was pretty bad.