Install a newer version of `less`

The version of less which ships in macOS Monterey (12.0) is 487, which was released in March 2017. Since then, it’s gained some features:

  • Line marking. Marking a line allows you to assign a shortcut letter to it to jump back.
  • Search result clearing.
  • Adds a status column, to show marks and indicate lines where search results are found.
  • Mouse support, so e.g. scrolling works in the document using the mouse.

At first it seemed like this may be the general problem of Apple disallowing GPL version 3 software, but less is dual-licensed to a more Apple-favorable one as well. It’s somewhat inexplicable that such a commonly-used command line library sees no updates.

Fortunately, it’s included in Homebrew. And even better, unlike the Apple distribution, they do not disable lesskey support, which allows specifying additional command and keyboard shortcuts for less to use.

Making shift-space send page up and other key mappings in iTerm2

A common problem when I am paging through less output is that, while the space key will go down a page, the shift-space shortcut does not go up. The underlying reason is terminals are strings of text and date back decades and many key combinations are archaic sequences.

Shift-space is is one of these cases. While the space key inserts visible text, the shift-space variant doesn’t have a unique character. This requires hoping particular app can handle the sequence CSI 32;2 u (which may look like ^[[32;2u; this is part of a proposal known as CSI u), or changing the key map in the terminal. I went for the latter.

Continue reading “Making shift-space send page up and other key mappings in iTerm2”

Back to Safari

Chrome arriving on Mac was an amazing upgrade in the normal browsing experience. However, Safari’s new features and battery savings in Mavericks prodded me into giving it another try.

A few utilities made it a lot easier to use Safari:

  • YouTube5 enables many YouTube videos that would otherwise not work.
  • command-number-tab can power using ⌘1, ⌘2, etc. for switching tabs.

Update 2015-06-14: Safari in OS X 10.11 adds a preference for doing the ⌘1..N shortcut without needing a hacky extension.

There are also a few really important shortcuts to pick up fast:

  • ⇧⌘\ opens the “tab expose”; you can then swipe left and right or use the arrow keys to switch tabs. (There’s a gesture, too, but two-finger pinch-out isn’t easy.)
  • ⇧⌘R opens the reader view, which seems better than I remember. It saves scroll positions when you click links, and reformats text impressively.
  • ⇧⌘L opens the bookmarks sidebar, which I’ve found quick and easy.

Zooming is really clean: like in iOS, you can two-finger pinch to fluidly zoom in; and two-finger tap will intelligently zoom to fit the content.

I’ve still itched for Chrome a few times, especially when trying to sign into a second session on a webpage or use it logged out: I end up using Chrome’s incognito windows fairly often. These happen fairly often in my workflow.

Overall, I think Safari suits my needs pretty well without needing to bother with Flash or overwhelming extension use like in Firefox. It uses less power than Chrome, and just feels faster.

Custom Kindle Paperwhite fonts

I thought jailbreaking would be required to install custom fonts on the Kindle Paperwhite, but a recent Kindle firmware update silently added support for accessing custom fonts.

This writeup walks through installing custom fonts on a few devices. A few simple steps will get you through it:

  1. Mount the Paperwhite.
  2. Create the file USE_ALT_FONTS in the mounted volume.
  3. Create the folder fonts in the mounted volume, and add fonts consisting of all the following (where Font is the name of your font):
    • Font-Regular.ttf (.otf is also supported for the files)
    • Font-Bold.ttf
    • Font-Italic.ttf
    • Font-BoldItalic.ttf
  4. Restart the device (Hamburger > Settings > Hamburger > Restart)
  5. You may need to clear the font cache by searching on the home screen for ;fc-cache and then restarting.

You can find your Mac’s fonts in one of a few places:

  • /System/Library/Fonts
  • /Library/Fonts
  • ~/Library/Fonts

Although I love reading in Georgia, it doesn’t render wonderfully on the Paperwhite, so the hunt is on for better typography.

Preventing Rdio from using discrete graphics

Rdio requires the discrete graphics card on systems which support dynamic switching. This is annoying, since playing audio shouldn’t require intense graphics.

To get around this limitation, we can update the Rdio app’s Info.plist to inform the system that it supports the integrated card. We can accomplish this with the following command:

defaults write /Applications/ NSSupportsAutomaticGraphicsSwitching -bool YES

To revert back to forcing the discrete card, we can remove the key:

defaults delete /Applications/ NSSupportsAutomaticGraphicsSwitching

Incidentally, gfxCardStatus is an excellent tool for monitoring graphics card changes and manually switching between cards.