Selecting whole word using keyboard only

On macOS, create a file ~/Library/KeyBindings/DefaultKeyBinding.dict with the following content:

{
    "^w" = (selectWord:);
}

If the file already exists, add the second line above within its top-level braces.

Restart (quit and start again) an app to apply new key bindings.

Now you can press ^w (Control-W) in any native application (i.e. not Firefox, Eclipse, etc.) to have it select the current word.

You can customize the shortcut, ^ is Control, ~ Option, $ Shift, @ Command.


Some applications include menu items for this action. TextMate, for example, uses the ^w shortcut for Edit » Select » Word by default.


There is a better way. AutoHotkey.

http://www.autohotkey.com/

Or if you are in Visual Studios, Ctrl W selects the whole word.