MacOS has several keyboard shortcuts that work everywhere – in your browser, in your terminal, in any place where you can input text. I call these the "Control Hotkeys" since they all involve holding the Control key.

These shortcuts seem to originate from Unix (MacOS is built on top of Unix), and they work in Linux as well.

You may be asking: why should I bother learning these? Well I will tell you: I use these thousands of times each day. They dramatically speed up my typing and text editing. And I rarely ever have to use my mouse, the arrow keys, or take my fingers off the letter keys of my keyboard.

What is Swap Caps on Mac and Why Do it?

Caps Lock is a useless key. So I remap my Caps Lock key to instead be Control. Then I can easily move my left pinky over to hold it when I do these shortcuts.

You can do this in MacOS like this:

  1. Go to Mac preferences

  2. In the search box, type "modifier keys" and click it

  3. Set Caps Lock to Control

4fe46c32-277c-49b9-801a-e1e405073336

Here's the full list of Control Shortcuts I use on Mac:

Movement

  • Control+f – move the cursor to the right

  • Control+b – move the cursor to the left (backward)

  • Control+n – Go to the next line

  • Control+p – Go to the previous line

  • Control+a – Go to the beginning of the current line

  • Control+e – Go to the end of the current line

Deleting / Substituting

  • Control+h – backspace

  • Control+d – delete the character to the left (this is like the traditional delete key on Windows, and as far as I know, this shortcut is the only way to delete this way on Mac)

  • Control+t – switch the position of two characters

  • Control+k – "yank" the current line of text.

  • Control+y – "paste" the yanked line. Note that this uses a different clipboard than the traditional clipboard, so you can use to it have two things stored at the same time – one for your Command+v paste clipboard and one for your Control+y clipboard.

Again, once you get used to these, they'll save you a TON of time. Just a few milliseconds each time, but those add up very quickly over the course of a day at the keyboard.

Happy coding.