Some of the default keyboard settings and shortcuts on macOS simply don’t work for me as a software developer. As soon as I get my hands on a new mac, I change some keyboard settings and shortcuts for general text editing, window management, iTerm2 and some other stuff. I’m going to go over everything I do step by step in this post. I’m sure you’ll find at least some of these tips & tricks pretty useful.
First of all, if you’re using an external keyboard, you should make sure that your keyboard is identified correctly. Usually you don’t have to worry about this, but recently my keyboard was identified incorrectly for some reason while I was setting up macOS for the first time on my new Mac Mini.
You can check the identified keyboard type from System Preferences > Keyboard > Input Sources
If you find out that it’s incorrect, go to System Preferences > Keyboard > Keyboard and select Change Keyboard Type
For me, it turns out my keyboard was identified as ANSI while it’s actually ISO, so I had to change it:
Natural text editing shortcuts such as the ones below do not work by default on iTerm2:
⌃→(end of line)
⌃←(start of line)
You have to set the preset as “Natural Text Editing“ in order to fix this:
iTerm2 > Preferences > Profiles > [Profile Name] > Keys > Presets
iTerm2 lets you create multiple tabs, and you can even split a tab into multiple panes.
⌘Tcreates a new tab
⌘Dcreates a new pane by splitting the existing tab horizontally
⇧⌘Dcreates a new pane by splitting the existing tab vertically
These default shortcuts for creating tabs & panes are pretty nice. However, I don’t like the default shortcuts for switching between tabs/panes. That’s why I override them like this:
iTerm2 > Preferences > Keys > Key Bindings
⌘Tab is pretty useful for switching between different apps. What if you need to switch between windows of the same app? Sometimes, I have multiple iTerm2 windows or multiple VSCode windows open at the same time and I want to be able to quickly switch between those. Here’s how you can (re)assign a shortcut for that:
System Preferences > Keyboard > Shortcuts > Keyboard > Move focus to next window
Spectacle is a free app that lets you organize and resize your windows using keyboard shortcuts:
It’s no longer actively maintained, but I’ve been using it for a couple of years and I’ve had zero issues so far. It’s quite simple, and the default shortcuts are pretty good.
I use Vim for text editing, which means I don’t use my mouse to navigate in the text editor. That’s why I frequently need to press and hold some keys for scrolling up/down/left/right in the editor.
By default, key repeat is too slow and the delay until repeat is too long to do that fluidly. I adjust the settings like this, but you should experiment with each option on your favorite text editor and see what works for you the best:
System Preferences > Keyboard > Keyboard
Pressing and holding the arrow keys (
↓) lets you fluidly navigate between rows (lines) and columns (characters) in the editor by default.
Unfortunately, that’s not the case for Vim equivalents (
j). For instance, even if you press and hold the
j key, it only advances to the next line and it gets stuck there by default. You have to run one of the following commands after installing the VSCodeVim extension to have the same fluid behavior, as pointed out in the GitHub page of the extension:
# For VS Code
⌃Space is a very handy key combination and should be assigned to a frequently used shortcut. However, it’s assigned to another shortcut by default, so it needs to be unassigned first.
My command-line shell preference is zsh and one of my favorite zsh plugins is zsh-autosuggestions. It allows you to define a custom hotkey to accept the current suggestion. For me,
⌃Space fits perfectly into this use case.
I know that this isn’t related to keyboard settings or shortcuts, but I still want to mention it because I think it’s important.
I don’t know about your experience, but the default font smoothing is too much for me. What’s worse is, macOS doesn’t let you change this setting easily from system preferences anymore. You have to actually open the terminal and run this command:
# 0, 1, 2, or 3
Setting it to 1 works best for me. I suggest you to experiment with each option (0 is lowest, 3 is highest) and see whichever feels best. Keep in mind that in order to see the effects, you have to logout & login back every time you change the setting.
Feel free to leave a comment on Twitter if you have some other tips & tricks that haven’t been covered in this article. I’d love to hear them!