Yet more new keybindings for macOS

[Tweet]

I’ve added a few new shortcuts to my astounding1 collection of macOS keybindings. You can check them all out on the project page (and, if needed, figure out what the heck I’m talking about), but here’s what’s new.

First, a simple command that’s just for convenience: shift-space to move forward one character without inserting a space or deleting anything that’s selected. It’s exactly the same as hitting the right arrow key or pressing ⌃f. I just wanted the convenience of having it in a handier location when typing. You might hate it, especially if you often linger on the shift key when hitting space, because it will lead to unexpected behavior when you’re using one of the most ingrained keys in your muscle memory (the spacebar).

As a solution to the lingering shift, if you’re not already using your hyper key with the spacebar for something else, it might make a better option (setting the binding to ^@~$\040. Mine’s been the shortcut for Dash for long enough that it would take too much getting used to.

Second, some shortcuts for changing programmer-style casing in a string. These will only be useful for people who regularly want to convert from snake_case to camelCase or vice versa. I often find myself needing to do this outside of an editor with built-in case conversion, so I made a couple of quick shortcuts.

These are all multi-stroke, mostly because I’m running out of keys these days. Ctrl-Option-c starts them, then the second key chooses the function. The first one is snake_case to camelCase. If you place your caret (edit cursor) before the underscore in “snake_case” and hit ⌃⌥c, c, it will delete the underscore and capitalize the next character, giving you “snakeCase”. It deletes the character following the caret indiscriminately, so it also works with a hyphen, or a space, or possibly a character you didn’t actually mean to delete (if your caret is in the wrong place). It just replaces the need to delete, select, and then re-type the first character as uppercase.

The second one converts to snake_case by an inverse method, inserting an underscore and lowercasing the next character. Put the caret between the “lC” in “camelCase” and hit ⌃⌥c, s and you’ll get “camel_case”.

That’s it. As always the project page and GitHub repo are updated with the new bindings.

  1. Sure, some might say horrifying. Or unwieldy. So be it.