Last Updated: February 25, 2016
·
1.512K
· brianriley

Ctrl-w everywhere

Ctrl-w, for the uninitiated, is an amazing productivity secret. There's a point where your typing speed is so fast that it's slower to backspace to a typo and fix than it is to just delete the whole word and start over. Ctrl-w deletes the previous word. Open up a terminal and try it now.

That's right, a terminal. In OS X (Mavericks, at least), Ctrl-w only works in terminal, including vim insert mode. Option-delete does the same trick outside of terminal--but who wants 2 ways to delete the previous word?! Don't worry: you can get Ctrl-w everywhere in OS X; here's how.

Edit ~/Library/KeyBindings/DefaultKeyBinding.dict to look something like this (you may need to create the folder):

{
    "^w" = "deleteWordBackward:";
}

Or add the "^w" entry to any existing bindings you already have. Restart any program, and enjoy the blazing speed at which you can now type and correct with Ctrl-w!

Disclosure: I can't take full credit for this tip. I learned it here.

2 Responses
Add your response

On a PC, we use Ctrl+Backpace:)

over 1 year ago ·

Well, ctrl-w is a vim binding, and the equally useful vim binding ctrl-h (delete back one character) is available everywhere in OS X by default, so it's dang nice to know how to make ctrl-w do the same!

over 1 year ago ·