News for hackers. Stuff that matters.
Re:16-inch MacBook Pro by dashwav on Wednesday November 13, 2019 @08:53AM (#21523966)
The escape key will be especially welcome by me, as I found the touchbar exceptionally hard to deal with, and I would often have to hit it three or four times to get vim to exit insert mode. I actually didn't have much trouble with the arrow keys, despite all the negative feedback I saw for them online.

Hopefully this trend continues and they can iterate on this model even further.

Re:16-inch MacBook Pro by crusso on Wednesday November 13, 2019 @08:58AM (#21524042)
I remapped caps lock to escape and it's been wonderful. The oversized caps lock key on keyboards is an inexplicably bad UI choice anyway.
Re:16-inch MacBook Pro by DogLover_ on Wednesday November 13, 2019 @09:17AM (#21524292)
This argument as THE SOLUTION really needs to stop. As an example I mapped caps to ctrl a long time ago so this won't work without compromises.
Re:16-inch MacBook Pro by hinkley on Wednesday November 13, 2019 @05:24PM (#21530344)
Right? The solution is 'make the fuckin keyboard work'. These are workarounds.

I have twenty... seven, Jesus. Twenty seven years of muscle memory with VI. The only keyboard I can't 'vote with my feet' on is the built-in one on my laptop. As a result I'm hardly ever using my laptop untethered now. I don't think I've ever owned a keyboard I've typed less on than the touchbar macbook. Which means I'm barely using them as laptops, which is a little depressing.

Re:16-inch MacBook Pro by foldr on Wednesday November 13, 2019 @02:11PM (#21528162)
You can use Karbiner to have a short press of caps lock map to escape and a long press to control. Works pretty good.
Re:16-inch MacBook Pro by 2muchcoffeeman on Wednesday November 13, 2019 @03:41PM (#21529297)
I almost never use caps lock so I just mapped caps to esc and hold shift for all caps. The no escape thing doesn’t bother me anymore.
Re:16-inch MacBook Pro by fwip on Wednesday November 13, 2019 @02:27PM (#21528372)
Yep - I have mine set to be control if pressed with other keys, and escape if pressed alone. Works for everything except if I'm playing a videogame that uses ctrl to crouch.

Other people argue that all real vimmers use ctrl-[ instead of escape.

Edit: This is on a 2015 macbook pro, that still has the physical function keys. I almost never use the physical escape key, just capslock instead.

Re:16-inch MacBook Pro by qmmmur on Thursday November 14, 2019 @05:38AM (#21534375)
Is there a guide on this?
Re:16-inch MacBook Pro by foldr on Thursday November 14, 2019 @08:39AM (#21535240)
Install Karabiner-Elements. Go to the "complex modifications" tab. Add "Change caps_lock to control if pressed with other keys, to escape if pressed alone".
Re:16-inch MacBook Pro by qmmmur on Thursday November 14, 2019 @04:38PM (#21539724)
Thanks mate.
Re:16-inch MacBook Pro by philwelch on Wednesday November 13, 2019 @05:12PM (#21530199)
Can you map ctrl to esc?
Re:16-inch MacBook Pro by Tsiklon on Wednesday November 13, 2019 @09:10AM (#21524197)
Personally I find a classic Unix layout to work best for me. I’ve mapped the caps lock key to CTRL. I use that far more than I ever use caps, it feels quite natural to me after about a week or two of adjustment.
Re:16-inch MacBook Pro by PascLeRasc on Wednesday November 13, 2019 @09:18AM (#21524319)
You can use Karabiner Elements to configure your Caps Lock to act as Ctrl when held down, and escape when tapped alone. Best of both worlds.
Re:16-inch MacBook Pro by matttb on Wednesday November 13, 2019 @10:31AM (#21525211)
In addition to this you can do something like mapping Shift+Caps Lock to be an actual Caps Lock toggle. Now you get 3 buttons for one and it works amazingly well.
Re:16-inch MacBook Pro by darkteflon on Wednesday November 13, 2019 @06:00PM (#21530708)
This was a revelation when I discovered it earlier this year. I could never go back now, it’s so convenient.
Re:16-inch MacBook Pro by ghaff on Wednesday November 13, 2019 @09:17AM (#21524303)
>The oversized caps lock key on keyboards is an inexplicably bad UI choice anyway.

It's probably largely a relic from typewriters when it was originally something of a mechanical necessity and then made more sense than today in the context of filling out forms etc.

Re:16-inch MacBook Pro by macintux on Wednesday November 13, 2019 @09:43AM (#21524622)
Sun and Apple both used to have control in that spot. It was a sad day when they surrendered to the inferior PC keyboard layout.
Re:16-inch MacBook Pro by ghaff on Wednesday November 13, 2019 @09:58AM (#21524819)
I used to have really strong opinions about keyboards. I even still have a Northgate keyboard which was an "improved" version of the original IBM keyboard. (Which largely mirrored the Selectric.)

But TBH, I use so many different systems these days that I pretty much just accept that keyboard layouts and keyboard feel are going to differ from machine to machine and there's no point fussing about it.

Re:16-inch MacBook Pro by ghshephard on Wednesday November 13, 2019 @01:45PM (#21527781)
I haven't used a laptop, desktop, or other computer (windows/mac/Linux) in the last 15 years in which I didn't immediately configure Caps-Lock to be control within 5-minutes of setting up the system. So, to some degree - it's always been control for me.
Re:16-inch MacBook Pro by dublin on Wednesday November 13, 2019 @01:52PM (#21527881)
FWIW, early PC keyboard layouts had the Control key next to the "A", where God intended it to be, too. (Don't have the link handy, but there was a story posted here on HN in the past week or so about the history of the PC keyboard that showed this...)
Re:16-inch MacBook Pro by wyclif on Thursday November 14, 2019 @07:24PM (#21541106)
True, and as a longtime fan of the IBM Model 'M' that had that configuration and was mechanical and built to last with buckling springs, I'm glad I can get one of these:

https://www.pckeyboard.com/page/product/40PSA

Re:16-inch MacBook Pro by ImprovedSilence on Wednesday November 13, 2019 @03:31PM (#21529181)
I remapped jk to escape. It’s easily my favorite remap, I don’t even bother with escape on full keyboards/desktops.
Re:16-inch MacBook Pro by Lio on Thursday November 14, 2019 @07:37AM (#21534908)
That's a bit of a pain if you put that into muscle memory and use other Vi interface software that can't be remapped.

Personally I'm in the Caps to Ctrl and use Ctrl-[ for escape camp. Works in my shell, REPLs and in my database clients and anywhere else with a readline interface that isn't Vim.

Even with that I still want a physical escape key.

Re:16-inch MacBook Pro by goerz on Thursday November 14, 2019 @12:04AM (#21532924)
how do you type "e_{ijk}"?
Re:16-inch MacBook Pro by ImprovedSilence on Friday November 15, 2019 @07:22AM (#21544241)
jk is a pretty rare combo to begin with, but when you do need it, just hitting j, and pausing for a second takes that input singularly, then you can type k safely. Slightly sub optimal, yes. But the benefits outweigh the negatives for me.
Re:16-inch MacBook Pro by L3viathan on Friday November 15, 2019 @05:38AM (#21543816)
For example by typing: e_{ij<c-v>k}
Re:16-inch MacBook Pro by stevehawk on Thursday November 14, 2019 @09:11AM (#21535446)
obligatory xkcd - https://xkcd.com/1172/
Re:16-inch MacBook Pro by ilogik on Wednesday November 13, 2019 @09:01AM (#21524088)
I was listening to the Upgrade podcast (from relayfm), the episode that was just released includes an interview with someone from Apple (I think she's the PM for the MBP?)

She specifically mentioned vim users as one of the reasons for bringing back the escape key

Re:16-inch MacBook Pro by forgingahead on Wednesday November 13, 2019 @03:29PM (#21529150)
This is the link to the podcast if anyone is interested: https://www.relay.fm/upgrade/271
Re:16-inch MacBook Pro by seirl on Thursday November 14, 2019 @08:20AM (#21535126)
Do you have a timestamp for the vim thing?
Re:16-inch MacBook Pro by cjsaltlake on Sunday November 17, 2019 @09:55PM (#21561564)
~19:50
Re:16-inch MacBook Pro by NetOpWibby on Wednesday November 13, 2019 @04:19PM (#21529705)
Thank you
Re:16-inch MacBook Pro by sdan on Wednesday November 13, 2019 @09:05AM (#21524142)
How long ago was "just released"?

Pretty sure Apple employees are locked into heavy NDAs (like many others in tech).

Re:16-inch MacBook Pro by raydev on Wednesday November 13, 2019 @11:45AM (#21526132)
The episode was recorded earlier with Apple's blessing, given the presence of an Apple employee speaking on the record.

The episode was released this morning, after the embargo lifted.

Re:16-inch MacBook Pro by briandear on Wednesday November 13, 2019 @11:45AM (#21526126)
It was released today and that’s Jason Snell’s podcast. The PM was authorized to talk.
Re:16-inch MacBook Pro by prewett on Wednesday November 13, 2019 @05:01PM (#21530092)
Use Ctrl-[ for ESC.

Not only is [ always in the same spot, but you don't have to move your fingers off the normal keys or stretch. I was fortunate that a friend told me about that early on, otherwise I couldn't have handled VI, the stretching is so inconvenient (especially so on those old IBM PS/2 keyboards with cubic keys).

Re:16-inch MacBook Pro by cesarb on Wednesday November 13, 2019 @07:52PM (#21531625)
> Not only is [ always in the same spot

Only if it's the same keyboard layout. For instance, on the US layout, [ is immediately to the right of P, while on the ABNT-2 layout, it's two keys to the right of P. Meanwhile, ESC is on the same place (top left of the keyboard) in both.

Re:16-inch MacBook Pro by ashton314 on Wednesday November 13, 2019 @08:59AM (#21524058)
Personally an Emacs user---I use the esc key loads too. Best thing I ever did was install Karabiner to remap capslock to esc when tapped, and to ctrl when held down. (One meta key to rule them all!) Have you tried anything like that? Just curious.
Re:16-inch MacBook Pro by ascagnel_ on Wednesday November 13, 2019 @08:56AM (#21524015)
I remapped `jj` to escape (shortly before the touchbar was announced), because I disliked either having to move my hand or use both hands to get out of insert mode.

map! jj <Esc>

Re:16-inch MacBook Pro by seanhunter on Wednesday November 13, 2019 @09:02AM (#21524108)
Yeah similarly I use

inoremap jk <Esc>

Re:16-inch MacBook Pro by roland35 on Wednesday November 13, 2019 @09:09AM (#21524182)
jk is the way to go! It is the fastest for me to type vs jj or kk.
Re:16-inch MacBook Pro by positr0n on Wednesday November 13, 2019 @09:24AM (#21524378)
If you map jk and kj to <Esc> you can just mash both keys at once and it doesn't matter which one registers first!
Re:16-inch MacBook Pro by darkteflon on Wednesday November 13, 2019 @06:06PM (#21530758)
Have to ask: for all you jj / jk mappers, don’t you end up triggering this by accident when you’re just cruising around your code?
Re:16-inch MacBook Pro by positr0n on Thursday November 14, 2019 @09:46AM (#21535728)
For cruising around my code the advantage is that jk/kj doesn't do anything in normal mode (cruising mode, haha). So I can just start mashing jk in a terminal window that I don't know what mode I left vim in.

The biggest downside to jk/kj mapping is that words that end with k are somewhat common. So a few times a week I will type something like "splunk" and want to exit insert mode immediately so I mash jk/kj after the k. 50% of the time the j is first so I end up with "splun" (kj is <esc>) (k moves up since we're in normal mode now).

Re:16-inch MacBook Pro by ascagnel_ on Thursday November 14, 2019 @09:55AM (#21535793)
> The biggest downside to jk/kj mapping is that words that end with k are somewhat common. So a few times a week I will type something like "splunk" and want to exit insert mode immediately so I mash jk/kj after the k. 50% of the time the j is first so I end up with "splun" (kj is <esc>) (k moves up since we're in normal mode now).

This is why I use `jj` instead of `jk`/`kj` -- as a native English speaker in a job where everyone primarily speaks English, there are few cases where I'd be writing code with a `jj` naturally in a string.

Re:16-inch MacBook Pro by alexjm on Wednesday November 13, 2019 @06:16PM (#21530848)
Very rarely. The only place I notice a difference is if the last letter I type is a j, the cursor 'hesitates' for a moment because Vim is watching for a k.

The advantage I found of jk over jj is that, in normal mode, jk is a no-op, so if I hit jk as Escape when I was already in normal mode, it doesn't matter.

The only problem is that when I'm editing text out of Vim, I end up with the occasional jk at the end of my typing. That almost happened while writing this comment.

Re:16-inch MacBook Pro by L3viathan on Friday November 15, 2019 @05:39AM (#21543823)
There's also vim-arpeggio, with which you can define mappings for simultanously held-down keys: https://github.com/kana/vim-arpeggio
Re:16-inch MacBook Pro by roland35 on Thursday November 14, 2019 @02:13PM (#21538370)
I haven't had that happen yet with jk at least, I could see jj triggering something if you have the timeout setting too long.
Re:16-inch MacBook Pro by vcavallo on Wednesday November 13, 2019 @08:59AM (#21524050)
ctrl-[ works out of the box
Re:16-inch MacBook Pro by jandrese on Wednesday November 13, 2019 @02:00PM (#21528005)
But it's pretty unergonomic.
Re:16-inch MacBook Pro by vcavallo on Wednesday November 13, 2019 @02:50PM (#21528667)
is it? I have ctrl mapped to caps-lock. so for me it's essentially home-row. left pinkie+right pinkie going almost nowhere. reaching for esc is decidedly not home-row.
Re:16-inch MacBook Pro by tga on Wednesday November 13, 2019 @02:40PM (#21528550)
A lot less than stretching for Esc.
Re:16-inch MacBook Pro by Unbeliever69 on Wednesday November 13, 2019 @02:30PM (#21528424)
ii here!
Re:16-inch MacBook Pro by j45 on Wednesday November 13, 2019 @09:11AM (#21524214)
The tough thing about the touch bar is how often it freezes. It's hard to get used to it when all that is noticeable is the few times a week it does it.
Re:16-inch MacBook Pro by rahoulb on Wednesday November 13, 2019 @09:49AM (#21524702)
I started using Ctrl-C instead of Escape in Vim years ago (long before the Touchbar) as it means I don't have to move my hands from the home position.
Re:16-inch MacBook Pro by graywh on Wednesday November 13, 2019 @02:25PM (#21528352)
ctrl-c is a poor substitute for several reasons

1. it cancels any modifiers on the insert command

2. it won't trigger any abbreviations

3. it doesn't work with visual-block insert

4. it bypasses InsertLeave autocommands

Re:16-inch MacBook Pro by na85 on Wednesday November 13, 2019 @06:16PM (#21530851)
>ctrl-c is a poor substitute for several reasons

Counterpoint: modal editing is a poor substitute for several reasons ;)

Re:16-inch MacBook Pro by super_mario on Wednesday November 13, 2019 @10:58AM (#21525541)
CTRL-[ is standard Vim mapping for Esc.
Re:16-inch MacBook Pro by secabeen on Wednesday November 13, 2019 @01:56PM (#21527939)
It's deeper than that. Control-[ is the same keycode as escape. [ is the next character after Z in ASCII, and Control-[ is the next character after Control-Z. It's not a mapping, they are one and the same.
Re:16-inch MacBook Pro by vcavallo on Wednesday November 13, 2019 @08:58AM (#21524045)
there are great alternatives to reaching up for ‘esc’ in vim. ctrl-[ is my favorite. the ol double-pinkie
Re:16-inch MacBook Pro by cymantic on Wednesday November 13, 2019 @02:09PM (#21528121)
kj
Re:16-inch MacBook Pro by skohan on Thursday November 14, 2019 @06:23AM (#21534566)
I have always used ctr-c. I didn't even really know escape was an option, so I never had to adapt.
Re:16-inch MacBook Pro by enriquto on Wednesday November 13, 2019 @04:16PM (#21529672)
you can map tab to esc inside vim so you dont need to type esc

    :imap <tab> <esc>
Re:16-inch MacBook Pro by skratchpixels on Wednesday November 13, 2019 @04:28PM (#21529789)
Tab is still important to programmers.

Developers with a new MBP manage by changing Caps Lock Key to Escape. Less pinky travel too.

If you need caps, you can download Karabiner and move caps to something else. I changed mine to pressing both Shift buttons.

Re:16-inch MacBook Pro by enriquto on Wednesday November 13, 2019 @04:34PM (#21529848)
> tab is still important for programmers

I disagree. If you are a even modestly decent programmer you know to configure autoindentation so that you never need the tab key for anything. I cannot imagine a scenario where I would need the tab key in insert mode (except a very fringe case where I need to enter a tab character in a literal string and for some reason there are no escapes like \t. But then again you can still ^V^I)

Re:16-inch MacBook Pro by apocolyps6 on Wednesday November 13, 2019 @05:24PM (#21530343)
You can't autoindent python, regardless of how good a programmer you are.
Re:16-inch MacBook Pro by enriquto on Thursday November 14, 2019 @02:14AM (#21533451)
of course you can!

you only need to press ENTER (to create a newline) and BACKSPACE (to exit the current block). You never need to press TAB

Re:16-inch MacBook Pro by Smaug123 on Wednesday November 13, 2019 @05:15PM (#21530241)
So presumably in a whitespace-sensitive language you would always leave insert mode to declare the whitespace?
Re:16-inch MacBook Pro by empthought on Wednesday November 13, 2019 @04:41PM (#21529918)
Lots of editor use the tab key to autocomplete. It's often called "tab completion."
Re:16-inch MacBook Pro by enriquto on Wednesday November 13, 2019 @04:56PM (#21530043)
of course, in vim you have ^o for that
Re:16-inch MacBook Pro by skratchpixels on Wednesday November 13, 2019 @05:47PM (#21530563)
I wasn't only speaking about Vim. Even then going to Caps is less travel than Tab.

I use Caps less than I use Tab like for switching programs.

Whatever works for you.

Re:16-inch MacBook Pro by jki275 on Thursday November 14, 2019 @02:29PM (#21538519)
Ah, no. autoindent is a nice feature that is never perfect.
Re:16-inch MacBook Pro by enriquto on Thursday November 14, 2019 @02:54PM (#21538753)
can you point to a minimal example where vanilla vim autoindent cannot cope with python code editing? I never found any situation where I had to press the tab key
Re:16-inch MacBook Pro by jki275 on Thursday November 14, 2019 @09:41PM (#21541802)
Have you ever refactored anything? Especially in Python, moving a line into a control block requires using the tab key. If you don't have to press the tab key either you're such a god programmer that you have never made a mistake or refactored anything you've ever written, or you're trolling.
Re:16-inch MacBook Pro by enriquto on Friday November 15, 2019 @12:10AM (#21542356)
there's >> and << for changing the indentation of a line.

And i'm not a good programmer, a good vim user at most