Brian Lovin
/
Hacker News
Daily Digest email

Get the top HN stories in your inbox every day.

aaronbrethorst

I was hoping this was about lesser known macOS keyboard shortcuts. Alas.

Apple has a pretty exhaustive list of so-called document shortcuts that I find particularly useful: https://support.apple.com/en-us/HT201236#text

Ctrl+A and Ctrl+E in particular to jump to the beginning and end of a line are a pair that I use dozens of times per day.

Same with Opt+Delete to delete the previous word.

I use Opt+Left Arrow and Opt+Right Arrow to move the cursor back and forward by whole words so often that I didn't even think about including it in here until I unconsciously used it while editing text.

Also:

Cmd+Space brings up Spotlight and is a great way to launch apps and open documents.

I've used SizeUp for well over a decade to rearrange my Mac's open windows. It's literally the first app I install when I get a new computer. https://www.irradiatedsoftware.com/sizeup/

kmarc

I find it fascinating that your examples are actually the readline/emacs shortcuts, or the workarounds that had to be implemented for the lack of PC keys (Home/End/PgUp/PgDown)

The more I got familiar with MacOS, the more I realized all those feature pictures ople praise MacOS for are just workarounds / copies from other systems, and (even power-) users just aren't familiar with other systems hence their amaze.

The inconsistencies that come with intermixing ctrl-option-command are just mind blowing. Even Windows got this right by making the Windows key control window manager specific actions.

kitsunesoba

It all depends on where one got their start in computing. I started on a Mac in 1996, and though the keyboard that it came with had home/end/etc I never learned to use them because I didn’t do much that was keyboard intensive, with most of my computer usage being drawing/graphics, games, or web browsing.

By the time I’d started working as a dev fulltime where those keys might’ve been useful, laptops had taken over and my work machine was a MacBook Air which wasn’t large enough to fit those keys even if they’d wanted to, and so I learned the built in macOS text nav shortcuts. They were never a workaround for me because I’d never used the home/end/etc cluster in the first place.

Even today when using Windows or Linux it’s with a 60/65% keyboard without those keys because that’s what’s comfortable. Reaching over to hit home/end on a larger keyboard would feel odd with how far removed it is from the rest of the board.

snowe2010

I always hated the home/end keys. The way Mac does it is way better and I didn’t really start using Macs until two decades after I used windows and Linux. Cmd+left/right is way easier to use, especially on a laptop and custom keyboard.

aequitas

> or the workarounds that had to be implemented for the lack of PC keys (Home/End/PgUp/PgDown)

Those keys are not lacking, but on laptop keyboards they are hidden behind the fn+arrow keys. But they also are not workarounds or replacements for those keys. On macOS Home and End scroll the document to the beginning or end, not the cursor to the beginning or end of the line. That can be done with cmd-arrow.

dan-robertson

Lots of those shortcuts are basically Emacs shortcuts. I’m always sad using gdocs on Linux that they don’t support the Emacs shortcuts.

interpol_p

Side note that these Emacs shortcuts also work on iOS pretty much everywhere (you even get it for free in completely custom text renderers, so long as you adopt the UITextInput protocol)

ngai_aku

How are you using the modifier keys in iOS?

colechristensen

Not just Emacs, but anything that uses readline or similar libraries. Most shells for example.

https://en.wikipedia.org/wiki/GNU_Readline

https://github.com/chzyer/readline/blob/master/doc/shortcut....

dan-robertson

I mean, readline shortcuts are also based on Emacs ones.

aaronbrethorst

Yep. Yank and Kill work too, among others

koinedad

I love these built in shortcuts. I’ve added Karabiner to remap caps lock to esc and ctrl (not for Vim) and also right cmd-hjkl for instant arrow key access.

Spotlight usually works for most of my needs as well.

It’s frustrating when an app overwrites built in shortcuts like in Intellij on Mac, searching for shortcuts in the menu bar search doesn’t allow opt-delete if I remember correctly.

Speaking of menu bar search… one of my favorite commands is opt-shift-/ to search available commands in the menu bar of an app.

dzhiurgis

IntelliJ text expansion hotkeys (option + up/down) or spell checker (option enter) should be part of every operating system.

eviks

It's much better to rebind all of those to more ergonomic alternatives that match your other apps using the tools listed (eg, to similar cursor keys you use in a text editor), which is also useful for non Macs you use (where you could do the same rebunds), rather then learning yet another set of bad old combos

drbaba

The defaults can be changed (DefaultKeyBindings.dict). However, those keybindings are not just “yet another set of bad old combos”; the same keybindings are used by default in Emacs on any platform, and by most POSIX shells and interpreters (Bash, Zsh, Fish, IPython, etc.). On Mac, they’re inherited by most other GUI text editors (e.g. Sublime).

eviks

These are exactly another set of bad old combos, and the fact that their use is widespread is just another example of how bad very common things are:

  -  it doesn't make sense to have a/e as beginning/end, there is a symmetry in the commands, but there is no symmetry in the a/e keybindings, they are on different rows

  - likewise, it doesn't make sense to use the less convenient ⌃ for such a frequent command (and this is also the rightful criticism of all the bad Emacs pinky defaults)
For example, you could use right ⌘ (a thumb key) as your text movement key (or even Space), then you have home keys

  - JKL; for cursor movements and

  - DF for your word movements (instead of having to move your whole hand to ⌥◀/▶)

  - A/⇧A for line start/end movements or maybe A/G if it's frequent enough to not warrant using ⇧
And then that would match your text editor keybinds, so you don't have to waste time remembering platform-specific keys.

And re. those other apps - it's better to rebind them all (or, rather, use a tool to have the keybinds work in all of them) as well to use something good rather that stick with the bad just because someone lacked good design chops in the past

jurip

Yeah. Those are the key combos for editing text, especially on a Mac. If an app does not support them, it's going to be some weird cross platform monstrosity and you're better off if you find a competitor.

ogsuspect

Thats because they come from GNU Readline

rstevens333

sizeup is excellent. add swish and it's even better.

httpteapot

I recently purchased a MacBook, and while I'm thoroughly impressed with the hardware, I find the keyboard navigation in the desktop environment somewhat lacking in comparison to my previous experience.

Having used Linux Pop OS for many years, I've grown accustomed to the intuitive and powerful tiling window manager and keyboard navigation shortcuts it offers. I'm struggling to find a comparable solution on the macOS platform.

richbell

It's a sore-spot for sure. I've found that Rectangle[0] does a good enough job.

[0] https://rectangleapp.com/

dcchambers

Rectangle is so good - it's the first thing I recommend anyone new to MacOS download. I don't know why apple hasn't implemented this natively.

arthurcolle

Magnet is also pretty good

snowe2010

Hammerspoon is by far the best option for devs, it’s more powerful than pretty much every solution out there, including better touch tool, and the only additional software I need is karabiner elements and alttab. Those three pieces of software will solve every single problem you have with Mac.

httpteapot

Does Rectangle has a shortcut to switch the focused window in a split screen?

hirvi74

Hammerspoon can do it for I have it in my config. I also have it so I can switch to open windows on the same Space (I can throw windows into a tiled view and jump around to them). It's extremely flexible if you are willing to play around with it.

wtvanhest

I’ve kind of solved this. You can snap windows but you need to add a shortcut in systems to do it. It’s not perfect, but it does work and overtime you miss it less and less

undefined

[deleted]

AlchemistCamp

I’m a very happy user of Rectangle, as well.

Trufa

As a more general suggestion, macOS likely isn’t good at imitating what you previously had, try to understand the workflow they’re proposing, adapt and learn it, it generally gets second nature and pretty decent soon enough, getting to work the way you envision is not apple’s strong suit.

nsonha

Classic blame the user kind of argument, what is the alternative workflow to "snap windows with a hotkey" then?

Tagbert

The point is that when switching OSs you are going to run into lots of places where the new OS does things differently that what you are used to. Your choice is to fight the new OS and try to keep doing things the way you are used to or embrace the new OS and learn some new workflows.

That doesn’t mean adopting everything or abandoning everything, just try to be flexible and try some different things out. Just because it is different doesn’t mean it is broken.

For window management there are dozens (at least) third party tools that add features like snap window. Try some out to see what you like. Rectangle, Magnet, Moom, BetterSnapTool come to mind but here are others.

eviks

The better general suggestion is to find good tools to make your OS life more comfortable rather than admitting defeat right away and imitating the bad old stuck ways of the OS

(it's not Apple's strong suit, but there is an app for tha™)

nordsieck

Sometimes that works. Sometimes you're just stuck.

For example, AFAIK, there's no way to eliminate the animation that's triggered when switching spaces/virtual desktops.

httpteapot

Do you know some good ressources to learn how to use macOS the productive way, using mostly keyboard shortcuts instead of the trackpad?

kashunstva

Apple maintains a list of macOS keyboard shortcuts that might be useful: https://support.apple.com/en-us/HT201236

snowe2010

You can use hammerspoon to solve almost every issue you have.

dan-robertson

I don’t really tile windows much. The main case where I do is with a bunch of terminal windows. Most of what I get out of a tiling window manager is full screen by default and easy keys to switch workspaces.

On macOS the thing that drives me insane is that the many-finger swipe to switch desktops won’t focus the target window until the animation is totally done (like 0.7s after starting). I wish it works like cmd+tab which changes focus instantly. Apart from that I guess I’m not that bothered because I mostly just full screen things. Emacs and iterm2 can do their own tiling of windows.

kps

I am not sure whether it applies to this case, but you might try turning on ‘Reduce motion’ under the Accessibility settings, which eliminates some animation delays.

dan-robertson

Reduce motion changes the animation to fade-in fade-out but updating focus is still delayed

voltaireodactyl

Just a heads up — you can solve that one annoyance; there are terminal commands that will reduce that animation to instantaneous.

dan-robertson

I tried changing various defaults but lots of them seemed to no longer work. Maybe I only tried the options to increase the speed or I didn’t restart enough things or I spelled something wrong. I also tried looking at the binaries for relevant-looking names of defaults to change and didn’t find any (including the options that old internet advice recommended changing)

userbinator

I suspect the constant emphasis on mouse use, ever since the first Macintosh, has created an attitude of "keyboard doesn't matter"; I've noticed that even early Windows is very usable with only a keyboard (the Alt, underlined letters, and arrow keys method is particularly well-designed), whereas e.g. classic MacOS is basically unusable without a mouse.

In later versions they added keyboard access, but it still feels like it was done as a bare-minimum concession and not originally planned.

troyvit

I had the opposite experience with MacOS. I hold every OS I've used since the early aughts up against MacOS 9 and they are all lacking in terms of keyboard navigation. Maybe it was because I had the previous 10 years to practice, but I felt I could do almost anything in pre-OSX MacOS with the keyboard, only relying on the mouse for application-specific stuff like photo editing. Navigating, filtering, opening files and folders were all incredibly easy.

In KDE it's pretty much a joke every time I have to save-as. Can't even get through that filesystem menu without a mouse unless it supports <ctrl>-l. Dolphin is slightly better, especially if you enable the console pane to make it easier to switch to the command line, but it's still way behind Apple's finder from 1999.

userbinator

but I felt I could do almost anything in pre-OSX MacOS with the keyboard

How do you open the menus and browse through them to find and select the option you want?

weaksauce

> has created an attitude of "keyboard doesn't matter";

I think you would be surprised at just how powerful the keyboard subsystem in osx is and how malleable it is with some programs or even just editing the plist shortcuts. every menu item in any application can be given a per app or universal shortcut in `system preferences | keyboard | shortcuts | app shortcuts`

You can also use a thing like hammerspoon to do whatever you can imagine basically too... i have a few things for window manipulations via hammerspoon.

You can set up very complex keyboard re-mappings/shortcuts using something like karabiner elements.

you can also change the keyboard access to be navigable via tab in keyboard settings too.

and you can access the menu via ctrl-f2 by default. those settings are changeable too via the keyboard preference pane.

i think you'd be surprised at how much apple cares about accessibility so keyboard nav is not just a power user thing.

At the end of the day I think apple put a lot of thought into the UI and i'd feel pretty stymied going back to windows.(though now the power utilities finally let you remap the windows key to something more useful like ctrl.

eviks

Except you can't bind every menu item: some menu names are dynamic, so you can't bind to them, and not all the keys are supported, and there is no left/right modifier differentiation. Also, you have to retype the full command path by hand, which is insane, so you can't do that either (you should be able to just hover over a command and press keybind to rebind)

Even with the awesomeness of Karabiner Elements there are some unfortunate limitations

But yeah, I'd be surprised if it were a powerful system, that's so rare in the keyboard land...

userbinator

I was talking about pre-OSX.

eitland

My observation too.

It is kind of evolution, just for computers.

Macs early developed good pointing devices and as a result many keyboard related aspects can afford to be somewhere between weird and crazy.

Bonus for Mac people insisting everything is fine.

And I still consider getting a MacBook Pro next month, Windows PCs are that bad even with WSL :-/

Edit: at least these days, fn and ctrl can finally be remapped and CMD-tab can be fixed so it works consistently between two Firefox (or two Safari) windows, an IDE and Finder. It used to be that I would have to CMD-tab to the Firefox group, then CMD-| to get to the correct browser window and it was one of the things that truly messed up my workdays the last time I used Mac back in 2012. (No dedicated home/end buttons and every app seemingly being free to choose what shortcut they would use for it was probably the most painful one though.)

jen729w

I’ll just throw Magnet in the ring for a tiling solution.

I have keyboard shortcuts well in muscle memory now for left/right third/half/two-thirds, and all four corners at a quarter of screen, and full screen. I find that meets 90% of my needs.

Left/right two-thirds is my go-to when coding on 14”. VSCode on the left, Safari on the right. Both big enough to work well, but both leave enough of the other visible to be useful.

Nice little app, costs some reasonable amount of money as a one-off purchase.

orf

I use Magnet, but settings not syncing across devices is a bit annoying.

snowe2010

Hammerspoon can handle that and much more, way more customizable and you can do amazing things like grid layouts. Completely open source, totally free, and the more people that use it the better it gets so I highly recommend it.

alin23

You can mimic that in part with yabai (https://github.com/koekeishiya/yabai). Disabling SIP gets you instant Space switching and creating without animation just like Pop_OS.

But you can get very far to an automated tiling WM and keyboard navigation even without disabling SIP.

bartvk

Just because this often comes up; I don't want to disable SIP. However I'm very happy with yabai.

foxandmouse

I didn't realize it was possible to use it without disabling SIP, excited to give it another shot! AltTab with a few modifications is currently my preferred way to manage windows.

rovr138

As another suggestion, Better Touch Tool does great for tiling window manager and adding shortcuts.

It's one of the first things I always need. It started coming from Linux with a similar experience to you.

----

A big shortcut for me is cmd+shift+/

It allows searching on all submenus. So when I'm working on an IDE for example, it's how I find those obscure options I know are there but I don't use frequently enough to remember the shortcut.

heywoodlh

I use NixOS+GNOME+pop-shell for tiling windows on Linux, and I love it!

I am quite frequently on MacOS, and I use Yabai[0] and skhd[1], managed with Nix-Darwin[2] for tiling windows and custom keyboard shortcuts. With how I make my Linux and MacOS builds look and feel identical it's pretty easy for me to forget when I'm on one vs the other.

For anyone curious, here's my repository for deploying my configs[3]. It's awesome to have one source of truth for managing NixOS servers and workstations, MacOS workstations, and other Linux workstations with Nix installed.

[0] https://github.com/koekeishiya/yabai

[1] https://github.com/koekeishiya/skhd

[2] http://daiderd.com/nix-darwin/

[3] https://github.com/heywoodlh/nixos-configs

twoodfin

This post and thread are terrific, and the day I learned common Emacs bindings work in most corners of macOS was momentous, but…

Whenever advanced keyboard shortcuts are under discussion, I’m reminded of something I read, I think by Bruce Tognazzini, on an early Apple study of keyboard vs. mouse. They had set up the usual usability test—run through these common spreadsheet tasks or whatever—and compared skilled users exclusively on mouse with equally skilled users issuing keyboard commands via shortcut. Maybe they swapped them back and forth on the modes, I don’t recall.

When the experiment was over, the mouse and keyboard users agreed: Shortcuts were faster, switching hands to the mouse and issuing commands via the cursor was slower. But the actual measured results showed no significant difference. Tog speculated that there’s some deep perceptual circuitry that’s tuned to notice the cost of mode-switching but submerge into the subconscious the cost of recall.

EDIT: I'm sure he's referenced it a dozen times in a dozen places, but here's a version of Tog's analysis that's roughly what I remember:

https://www.asktog.com/TOI/toi06KeyboardVMouse1.html

We’ve done a cool $50 million of R & D on the Apple Human Interface. We discovered, among other things, two pertinent facts:

- Test subjects consistently report that keyboarding is faster than mousing.

- The stopwatch consistently proves mousing is faster than keyboarding.

This contradiction between user-experience and reality apparently forms the basis for many user/developers’ belief that the keyboard is faster.

People new to the mouse find the process of acquiring it every time they want to do anything other than type to be incredibly time-wasting. And therein lies the very advantage of the mouse: it is boring to find it because the two-second search does not require high-level cognitive engagement.

It takes two seconds to decide upon which special-function key to press. Deciding among abstract symbols is a high-level cognitive function. Not only is this decision not boring, the user actually experiences amnesia! Real amnesia! The time-slice spent making the decision simply ceases to exist.

alpaca128

I don't think this proves anything. For example there is a massive difference between people using shortcuts in an everyday application, people used to Vim/Emacs/whatever to a point they can do the basics without thinking about them, and people who actually customized their setup for their workflow.

And to me it looks like they only focused on the first case because of sentences like this:

> It takes two seconds to decide upon which special-function key to press

Yes, I can definitely believe that I wouldn't be faster than a mouse user if I had to select text with a keyboard in notepad or press Ctrl-Alt-whatever to do simple tasks. But good luck beating a proficient Vim user at anything that has to do with cursor movements, search/replace or repetitive steps - watch a competitive coder use Vim and see how often it takes them "two seconds to decide" to do anything.

I think overall people have a decent intuition about what the more efficient way to control an application is. I frequently use the mouse/touchpad too, because in many GUIs it's simply faster and you can feel that even when you start out focused on the keyboard. Often users switch between window management and using graphical applications, and in those cases leaving the hand on the mouse is the more convenient approach.

And lastly - does it even matter? When someone perceives a certain approach to be faster or smoother, then why not let them? In almost all cases the speed difference doesn't matter.

rgoulter

I wonder in what conditions this is true for.

I can imagine that moving the mouse to open an app from the macOS dock is about the same speed as using the Cmd+Space or some shortcut.

I can't imagine using the mouse to go to the start/end of line is quicker than using an easy to reach keyboard shortcut to do so.

I'd also wonder about differences in general computing literacy/etc. between 1989 and now. -- I'm not sure "people new to the mouse" describes a meaningful subset of professional computer users these days.

magarnicle

You might want to read this about that study: https://danluu.com/keyboard-v-mouse/

It's a counter-intuitive conclusion because it's a wrong conclusion.

kitsunesoba

The blog post mentions text expansion via Raycast, but macOS has had its own native text expansion for a long time now (I think maybe since 10.5? Would need to check) under System (Preferences|Settings) > Keyboard > Text Replacements, which comes with the added bonus of syncing to your other Macs and iDevices via iCloud. I've been using it for years and at least for my needs it works great.

Not mentioned are the text navigation shortcuts that have been built into macOS for a similarly long period of time. They work in any text field in nearly every app (with exception to a few oddball apps that are usually built with "game engine style" UI frameworks), and come in both control-based emacs style and Apple style flavors[0]. I use these constantly and they work exceptionally well for smaller keyboards (e.g. 60% or HHKB).

[0]: https://jblevins.org/log/kbd

alin23

Author here, I use the native macOS replacements as well, mostly because they sync with iOS and they save me a lot of typing on iPhone and iPad.

But Raycast works differently in that:

    - it has dynamic replacements (see the video where I use ,td to type today's date for example)
    - can place cursor somewhere inside the replacement
    - makes it easy to add new snippets (Cmd-S on copied text)
    - is a lot faster in general and can work inside words as well

gumby

> I use ,td to type today's date

That single feature alone is worth the app to me.

Okkef

Ah this is from the creator of the 'rcmd' tool. I absolutely love it. Press the right command key + the first letter of an app and it switches right to it! (rcmd + for firefox, i for iTerm, s for Slack, ...)

I came from i3 with 8 predefined windows, but the simplicity of rcmd is really amazing.

alin23

Thank you, I'm really happy to read you find rcmd so useful ^_^ Also came from i3wm and missed it sorely until I finally settled on rcmd + single-space.

Using multiple spaces on macOS is nowhere as easy as on i3.

detrites

Do you plan to make a post about your flute-making? Most interested.

alin23

I actually do plan, yes! There's so little concrete info on this subject on the internet, that I had to do a ton of trial and error to get fipple design right, tuning, choosing the right wood etc.

I want to collect all my notes on this and publish a series of articles in 1-2 months. Glad to see others interested!

nbzso

Better Touch Tool changed the way that I operate. Sequencing of keys can make you a productive monster:) Practically speaking, I remove the use of short keys that require to break my fingers every day.

jack_riminton

Yeah my most recent discovery is using GPT4 to create applescripts which are triggered by a key combination. One that I use all the time is to open a chrome window with a specific profile to certain webpages

ryangittins

Yes! I'm sure I'm not using it anywhere close to its full potential, but just being able to two-finger tap a link to open it in a new tab is huge.

What are your favorite shortcuts?

nbzso

I am using it with specific sequencing for different apps. One of the more strange use -cases is the combination of BTT and touch-bar-simmulator with Figma. Adding functionality to my vertical mouse and trackballs with different profiles for apps and so on.

sgt

TIL about https://folivora.ai/ (BetterTouchTool). Brilliant.. and it's so refreshing to see an app that I will own and won't be a subscription. I can't stand that.

paldepind2

I guess this is only of tangential relevance to the post, but Ctrl+n (which should work the same as arrow down) has been broken in Spotlight as of macOS Ventura.

The fact that this completely standard binding has been broken in a crucial macOS app for 5 months basically tells me that Apple does not care about the "Emacs-style" shortcuts in macOS.

joeman1000

It stopped working in safari too (for picking items from the dropdown of suggestions when you type into the address bar). Even if you edit `DefaultKeybinding.dict`, some of the bindings just don't take. Also broken in some places is 'alt-b' and 'alt-f' for forward and backward word movement. I've been remedying this with BetterTouchTool, but it isn't the same in some places.

darkteflon

This might be the place to ask, since half an hour of searching the other day came up empty for Apple Silicon Macs: does anyone know how to diagnose hotkey conflicts? I use hyper (caps) + q, e to navigate between spaces but hyper + q recently stopped working, so … I can only go right.

sbuk

Try Shortcut Detective. https://www.irradiatedsoftware.com/labs/

I haven’t used it for a couple of years, so it may be flakey, but worth a shot.

darkteflon

Thank you! Unfortunately it hasn’t been updated in a while and is very flaky on M1 Macs. Recognises some keys and not others - unfortunately not the one I need in this instance.

dan-robertson

One trivial trick that maybe isn’t widely known: holding down option changes some menus to have additional/alternate options, eg delete vs move to trash, at one point you could get more resolution options. I don’t think I’ve seen this anywhere else (on windows if you right click a file and click ‘delete’ while holding shift, you get actual deletion instead of moving to trash, but the text on the menu doesn’t update)

addandsubtract

You can configure the zoom function in the accessibility settings, too. And zoom in and out using the two finger scroll gesture. I use it daily.

alin23

Yep, Apple added a lot of options for configuring zooming. I went through all the Accessibility settings multiple times to find something that works for me. I used three-finger-double-tap for a while, but I really like three-finger-tap for middle click so it clashed with that.

That's why I eventually settled for the rcmd-lcmd sequence, it's much more convenient for me and doesn't clash with my other bindings.

pledg

apps you can install which allow keyboard tricks, rather than macOS native.

owlbite

Just finding the app native ones can be useful, I spent several years using macOs before someone told me about apple-spacebar bringing up a spotlight quick search, which is not the main way I launch things that aren't terminal commands.

zamnos

spotlight also does simple math! so convenient.

Daily Digest email

Get the top HN stories in your inbox every day.

Keyboard tricks from a macOS app dev - Hacker News