Faster Navigation with {i|iPad|mac}OS’ built in Emacs Navigation

I just listened to “E509 - Brent Simmons, Man of Many Hats” and the episode mentioned about Keyboard Shortcut for Navigation, but it uses arrow key as main modifier.

I usually use emacs style keybindings for anything, really, on ipad or mac. Let me give some example and the mnemonics:

  • typed something on spotlight, want to navigate upwards or downwards? ⌃N and ⌃P it is!
    • it works like the up and down arrow key in text inputs.
    • also works on most web browser’s address bar! (except Vivaldi)
    • also on omni box/command pallete for Sublime Text, VSCode.
  • in iA Writer for iPad, wanted to move to the first character of paragraph? ⌃A!
    • or maybe by chance, you want to move to the end of paragraph in Roam Research or Obsidian, then use ⌃E
  • use ⌃B to move one character back, or ⌃F for one character forward.
    • you can also add ⌥ to make this move by word instead of characters
  • add ⇧ key with each of them shortcut to make it text selection!
  • you can delete a character forward with ⌃D, or delete a word forward with ⌃⌥D

there is reerence at the near bottom of this page by harvard.edu.

The available keys are A E N P F B D for alpha end next previous forward backward delete.
These shortcut is easier for my fingers and wrist, and less error prone for me. It works for macOS, iPadOS and even iOS! Hope it helps some people :slight_smile:

EDIT:
clarifying that ⌃ is control, ⌥ is alt, ⇧ is shift buttons

4 Likes

Thanks for posting this. These EMACS key binding are very helpful, and I guess I’ve taken my use of them for granted, not thinking to share them.

^A and ^E are the ones I use the most.

Another is ^T which will transpose the two characters beside the cursor that you may have mistyped. (misytped becomes mistyped) It doesn’t work in as many places as the others, unfortunately.

2 Likes

yes, it is a built in Cocoa bindings. I also take those shortcuts for granted until I realized that some UI frameworks (some Electron, gtk or Qt, to name a few) having trouble simulating some specific shortcut(s).


the ⌃T seems useful if I have set the muscle memory for it! compared to having to delete those two characters and retype them.

like the other shortcuts, it “only” save you some milliseconds, but after you get used to them, you don’t ever want to lose them.

that’s why I cannot imagine the adaptation I should do when typing on Windows or Linux. want to move down and press ctrl+N on windows, new window instance summoned instead :joy:

1 Like
  1. Where do you enable these?
  2. Is there support for Vim keybindings (please don’t hurt me)
  1. it is built in. globally enabled for most application in macOS, iPadOS and iOS.
    the fastest way to check is press ⌘L right now, in the browser address bar press ⌃E to go to the last character (like $ does in vim). then press ⌃A to go to the first character (like 0 does in vim). then try ⌃F (like L in vim) then ⌃⌥F (kinda like E in vim, but not quite). press ⌃⇧F is like press V then L in vim.

  2. there is no built-in support for vim keybindings.
    that hurts I know, I am also an avid neovim user.
    I was that person who annoy developers, requesting feature for vim keybindings. Then I know about this global emacs navigation simulation, I try to live with this.

  1. Just tried this.
    :exploding_head: :exploding_head: :exploding_head:

  2. :cry: :sob:
    2.5) this is why my app usage is progressively nearing vim

  1. I guess Apple devs like emacs? the key shortcuts are less intrusive than vim’s though (like ^F instead of l) because of modal editing.

  2. the emacs users were right when they said “you’ll need to learn our keybindings eventually” cue manic laughter

3 Likes

More like the NeXTSTEP devs liked emacs (yes, these keybindings have been in the OS that long).

5 Likes

aren’t those unix keybindings? :eyes: :upside_down_face:

2 Likes

aren’t those unix keybindings? :eyes: :upside_down_face:

hmmm, if what you mean by UNIX is the terminal shell, even in the man page of the earliest shell, it is called emacs keybinding, with alternative of vi keybindings. see in the man page of sh(1), the 1st instance of word “emacs” if you search from top. sh

[…] By default, the line editing commands are similar to those of emacs. A vi-style line editing interface is also available. Line editing can be enabled at any time using the -o emacs or -o vi options to the set builtin (see SHELL BUILTIN COMMANDS below). To turn off line editing after the shell is running, use the +o emacs or +o vi options to the set builtin.

but this is surely an interesting topic for me to further research.

EDIT:
whoops, forgot to put the link to sh man page.

1 Like
  1. yes, I think so too, if Apple (or as @ChrisUpchurch say, NeXTSTEP) implements global optional vi keybindings, I think it won’t be practical.
  2. hahaha, by the reference of vim-emacs rivalry meme, I think both emacs & vim user might learn each others’ rival keybindings in some point in their live. vim user might use emacs keybindings in terminal shell, emacs user might learn to use vim keybindings when they experiment with evil-mode
1 Like

What keyboard are you using to be able to type ^N in iOS?

I use NuPhy Nutype F1. It was Kickstarter project.

It can be placed on top of macbooks’ butterfly keyboard too. The only downside is the bluetooth become a bit unresponsive if the target device is hot.
My macbook often become hot because I have no air cooler, and my country is hot. If you work in relatively cold area, this is one is quite good.

1 Like

And EMACS started out as macros for TECO, so EMACS inherited TECO’s keybindings.

Update: using Karabiner I got vim system-wide!

3 Likes

Looking at that reference, I’d say that a late TECO (1983) inherited the EMACS keybindings. TECO in the early 70’s and 60’s didn’t have this “^R Mode”. ^A was Output A Message To Terminal and ^E was a flag variable. The “W” command controlled “scope mode” when available, which uses a video display in a crude manner – it’s passive and there is no cursor to move around in it.

If you want TECO on your Mac, go here https://almy.us/teco.html

I was going on this:

One of the desirable features of EMACS was its use of TECO’s Control-R “real-time” line editing mode (TECO predates CRT/keyboard terminals), you can see the key bindings on page 6 of the MIT AI Lab 1978 ITS Introduction to the EMACS editor [scanned PDF], where ┌ is used to denote Control. In this mode, the key bindings were all control sequences, largely mnemonic: Control-E End of this line, Control-P move to previous line, Control-N move to next line, Control-B backward one character, and not least Control-A move to beginning of this line, Costas’ suggestion of “first letter of the alphabet” for this is as good as any.

1 Like

I realize that! The reference has it wrong because it states that the 1978 EMACS used a feature in a 1983 TECO. It’s certainly the other way around.

Surprised nobody has mentioned ^K (kill-line) - it basically deletes everything to the end of the line after your cursor - I use it all the time!

1 Like