macOS keybinding tricks: the repeat count binding

In Vim, most operations have can have a count specified in the keystrokes for the command, e.g. to delete 3 lines. You can do similar in any Cocoa text field (all Apple apps, plus most native apps). You just need to specify a keyboard shortcut to use before the count. Then you can hit that keyboard shortcut, type a number (X) and then hit a key or key combination to have that event repeated X times. keybindings, keyboard, shortcuts, tricks

→ Continue reading

macOS keybinding tricks: The kill ring

So you may have seen my KeyBindings project before. It’s an insanely large collection of keybinding tricks that work in any macOS text field. Well, any native cocoa field. You won’t have much luck in Electron or other non-native text editors. But for most uses, including in Safari, Mail, Notes, nvUltra, and most of the Markdown editors, the tricks work great. You can do things like adding TextMate-style ⌘⏎ to any editor to create a new line no matter where your caret1 (cursor) is in… editor, keybindings, keyboard, tricks

→ Continue reading

Ruby Regexp::scan with MatchData

This post will only be of interest to people writing scripts in Ruby. Seriously, zero utility if you’re not using Ruby. Though I would be curious how you accomplish the same thing in other languages like Rust and Python, because I’ve never gotten too deep with string manipulation in anything other than Ruby, Swift, and Objective-C. If you care to leave a comment with pointers, I’m all ears. regex, ruby, scripting

→ Continue reading