Hacker News new | past | comments | ask | show | jobs | submit login

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!


This is part of why I like the MacBook Air M1 computer so much. Great keyboard with an esc key.


> ...I like the MacBook Air M1 computer... Great keyboard with an esc key.

Modern wonders never cease!


Agreed. When my wife was looking to replace her 2013ish Air and comparing M1 Air vs Pro, I told her I'd pay $300 not to have the touch bar.


The last of the Intel macs have real Esc keys too (eg the 16” Pro)


non-Intel 16" Pros do, too. Escape key was added back in Nov 2019.


There are no non-Intel 16" Macbook Pros.


The MBP M1 also has a physical esc key AND a touchbar. Best of both worlds.


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.


Another popular thing people like to do is map something like <k-j> or <j-j> to Escape. This can be easily done in your vimrc.

While the <Alt-[a-z]> mapping is great and enabled by default, it does have the side effect of logging an extra key press based on the [a-z].


Brilliant! If this was all I learned today, it would not be a wasted day. Thank you.


Map Caps Lock to both! Tap is Esc, hold is Ctrl.


I got that working with Karabiner Elements but how do people get this to work on Windows and Linux?


KMonad supports customisations like that. It's cross platform (macOS, Linux, Windows).

Though I use a fancy keyboard with QMK firmware, which allows customising this without needing to change settings on the computer.


I do it with xmodmap on Linux.


Did you change your username? I didn't realize that was an option.


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 listed explicitly as an option in the FAQ.


What made you want to change it?


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!

I figure it's easier for people to remember now.


ctrl+c also works if you are using vim (and not vi). one handed!


That is one-handed in precisely the same way that ctrl-[ is one-handed.


Not on a Mac, unfortunately. I mean, I can place my thumb on the left control and pinky on the [ so maybe you’re correct


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.


Seconding this, especially if you have to SSH into remote or newly spun-up machines regularly.


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).


> 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

If you have a suitable Arduino (or compatible) lying around probably not a lot of work: https://www.arduino.cc/reference/en/language/functions/usb/k...

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.)

(It's even possible to get away with not using USB-specific hardware, like I did in the "old days": http://code.rancidbacon.com/ProjectLogArduinoUSB :D )

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.


Remap caps lock to escape.


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.


Capslock as esc/ctrl is great. Or Delete/Cmd. Whatever actually, as long as it’s not capslock.


I'm a big fan of using "jj".


I use kj to save time. ;)


+1 One of my most impactful "ergonomic" changes I've made!


Oh wow, this happened to me this week. I had no other option than to shutdown and restart. Super frustrating.


Just buy an iEscape for $199.99


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.


Map caps lock to ESC using Karabiner

https://karabiner-elements.pqrs.org/


You can do this natively in the Mac keyboard settings.


ctrl + ] sends an escape sequence. Remap caps-lock to ctrl and you never have to leave home row again!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: