Navigating macOS and VSCode with Emacs+Vim Key Bindings

I've recently migrated to macOS again. And while I've spent most of my life on Linux, it still feels great to come back to macOS, where most things "just work".

But every time I've come back to macOS, I end up leaving for Linux again at some point. And the main reason for this are the keyboard shortcuts and overall navigation which hurt my productivity a lot. As an example, I've never been able to figure out how to switch Spaces instantly. That has always bothered me immensely (but more on this later).

However, this time, I tried harder to get really comfortable with keyboard navigation across macOS, VSCode and of course Google Chrome. And I succeeded! I'm really happy with my current setup.

So, I've decided to blog about it. I've broken this down into 3 separate sections: VSCode, macOS and Google Chrome.

VSCode

I grew up using Emacs, but more recently switched to VSCode. So, I've had to make my keybindings Emacs-like. This took a few years but I'm very happy with where these are now. It's 400+ lines of JSON to set it all up. As an example, here's what I've had to do to get Ctrl+N working as I wanted it to:

[
  {
    "key": "ctrl+n",
    "command": "cursorDown",
    "when": "editorFocus"
  },
  {
    "key": "ctrl+n",
    "command": "workbench.action.quickOpenSelectNext",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl+n",
    "command": "showNextParameterHint",
    "when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
  },
  {
    "key": "ctrl+n",
    "command": "selectNextSuggestion",
    "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
  },
  {
    "key": "ctrl+n",
    "command": "history.showNext",
    "when": "historyNavigationEnabled && historyNavigationWidget"
  },
  {
    "key": "ctrl+n",
    "command": "list.focusDown",
    "when": "listFocus && !inputFocus"
  },
  {
    "key": "ctrl+n",
    "command": "outline.focusDownHighlighted",
    "when": "outlineFiltered && outlineFocused"
  },
]

(Yes, now that I'm on macOS, I probably don't need any of this since Emacs shortcuts generally just work here. But, I'm going to keep these in my VSCode configuration in case I ever move back to Linux again.)

You can find my full keybindings config here. A lot of it is very personal and not Emacs-driven, so it's probably not very useful to others. There's also some Emacs extensions for VSCode, but I'm not sure how well those work.

macOS

For macOS, as I mentioned above, I've always struggled with switching Spaces instantly. But I've found a very good solution to this problem: HotKey App. With HotKey, I've been able to remap Ctrl-1, Ctrl-2, Ctrl-... to open Chrome, VSCode, iTerm, Slack, Notion, etc. This way, I can basically pretend all of these apps are on different "spaces" but in reality I only have 1 space.

I know that's a big compromise. But, I've realized don't need Spaces at all. What I need is to be able to instantly switch between my most used apps. And I'm so happy now!

Furthermore, I've set up CleanShot X for screenshots, iTerm 2 with some custom shortcuts for pane splitting and navigation, Raycast for some window management and other things, as well as Scroll Reverser.

That's pretty much it. But, perhaps the most important thing I did was create a Notion document with all the necessary instructions to set up a brand new macOS machine. It's 38 steps long, but I've gone through it twice now and it's worked perfectly every time.

Google Chrome

Yes, I've heard about Arc. But I'm completely locked in to Google Chrome. It's a brilliantly well-built product, especially now with Google's fantastic password manager which works perfectly across all my devices (oh, and it is free!).

One of the main reasons why I'll probably never stop using Google Chrome is Vimium. This extension is a complete gamechanger in terms of web browsing. It's so insanely good that I've learned all the Vim shortcuts for it despite having used Emacs my whole life. I just can't recommend it enough.

That's it!

I'm not sure how interesting blog posts like these are for others... I mainly wrote it as a "pat on the back" to myself for having gotten to my current state of laptop productivity, and to consolidate some of my own decisions in writing just in case I ever go through some memory loss issue. I hope you enjoyed it though!

Maybe, just maybe, this time I won't come back to Linux.

Feel free to reach out on Twitter!