Select word/paragraph under the cursor

12 March 2013, 10:00

One feature that OS X lacks is the ability to select the word or paragraph under the cursor using a keyboard shortcut while editing text. You can do this using the mouse, of course, by double or triple-clicking the word or paragraph. But taking your hands off the keyboard can be a distraction.

Here’s a solution that lets you use Option+W and Option+P to select the word or paragraph under the cursor (Option=Alt on some keyboards).

Additionally, holding down Ctrl in addition will cut the word or paragraph ready for pasting elsewhere (i.e. Ctrl+Option+W to cut the word at the cursor position, and Ctrl+Option+P to cut the paragraph).

The downside is that the new keystrokes won’t work in certain apps, including Microsoft Word. But they work fine in apps like Mail, Safari and Pages. Additionally, the Option+W and Option+P keystrokes usually cause the “∑” and “π” characters to appear, so if you use these regularly then this tip isn’t for you (or you’ll have to use the Characters panel each time to insert the characters — Edit → Special Characters).

Here are the steps required:

1. Open TextEdit, start a new document (File → New), and ensure you’re working on a plain text document by clicking Format → Make Plain Text. If you see the Make Rich Text option there instead then move onto the next step.

2. Paste the following into the new document:

"~w" = selectWord:;
"~p" = selectParagraph:;
"^~w" = (selectWord:, cut:);
"^~p" = (selectParagraph:, cut:);

3. Click to save the file, and in the Save As dialog box hit Shift+Command+G and type the following into the dialog box that appears:


4. Click the New Folder button in the Save As dialog box and type KeyBindings. Then open the new folder you’ve created so you can save your new file there.

5. Give the new file the following name:


Quit TextEdit, then restart any open applications and the new shortcuts should work straight away. If not, log out and back in again.

Note that this tip is adapted from a technique outlined in more detail by Lauri Ranta here — thanks Lauri!



Know better?