Shift to Select

Do you write for a living? You probably know it is more efficient to keep your hands on the keyboard while working, reserving the mouse or trackpad for less frequently used functions. This is true of writing prose or computer code.

There is one interaction with a text editor where even the pros will default to mouse or trackpad: selecting text. Perhaps because it seems an inherently spatial task—it feels natural to point to the start and end of the text you want selected.

You absolutely can select text with the keyboard of course. Hold shift while moving the caret to add characters or lines to the selection. On macOS you can also hold option to add words rather than characters (ctrl for Windows and Linux). Other editors add additional key combinations and mechanisms to extend the selection, but there genuinely doesn’t seem to be much agreement for keyboard text selection beyond holding the shift key.

I’ve always found this rather unsatisfactory. Extending the selection a character at a time is way too granular when you aren’t editing a single word. Extending the selection by words is better, but machine-gunning the cursor keys (or depending on key repeat and reactions) feels clumsy in comparison to a trackpad gesture.

Could it be the mouse or trackpad is just better for text selection? For a long time I thought just that, but there is an alternative I find to be a clear win over a mouse gesture. It is both simple to recall and use yet and somehow a logical extension of a well-established convention.

In Ishmael, tapping shift selects the word under the caret and enables a word selection mode. You can then press shift+ or shift+ to add or remove words from the selection. In essence it works like the default shift and cursor mechanism, but one rank up—so we are working with words rather than characters. Tapping shift again expands the selection to the sentence rank and we can now extend the selection by entire sentences. Another shift tap and we are at paragraph rank. One more and we are at the scene level.

It feels surprisingly comfortable to use. Familiar, as though it had always worked that way and all we were missing was the gesture to advance through the ranks. But now it is trivial to select multiple sentences or paragraphs with a few key taps. For example:

  • shift shift (double tap) to select the sentence.
  • shift shift shift (triple tap) to select a paragraph.
  • shift shift followed by shift+ to select two sentences.

If you are not on a mobile device you can try shift-to-select by clicking the following button:

Ishmael has an option to expand the selection to text within braces or quotes. If your caret is somewhere between quotes, two taps of shift will first select the text within the quotes rather than the entire sentence (a third tap will expand to the full sentence). This feels right because text in braces or quotes is a clause in itself which you might want to delete, move, or change as a whole. It is optional because you might commit shift shift to memory as an action that means “select the sentence”, and adding this partial rank might not have the expected outcome for you. I personally write with it on. The feedback is instant, so I rarely end up doing the wrong thing.

I’ll concede that tapping the shift key is unusual on a desktop app. Outside of video games, I don’t think I’ve ever used an app that bound pressing shift on its own to something useful. Perhaps because it is hard to conceive of a modifier key not used in conjunction with another key. This lack of prior art is what makes it the perfect key for this mechanism. It also helps that shift already has a strong association with selection and that the physical key is a nice fat button a short distance from the home row.

In researching this post I discovered that Microsoft Word has a related mechanism. If you press F8, Word enters an extended selection mode where you can extend the selection without holding shift. Pressing F8 again expands the selection to the next rank. Useful, but it takes two taps of F8 to select a word compared to Ishmael’s one tap of shift. Word’s mechanism also doesn’t extend the selection by the current rank. In other words you can’t add the next sentence or paragraph without machine-gunning the cursor keys.

I’m tempted to port this feature from Ishmael to its sister project, Dinkus. If only to avoid the confusion when I double tap shift and nothing happens.


Update: Ok, it’s going to happen. The next Dinkus release will support shift-to-select.

← All posts