Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I like to type fast. I'm a chronic delete-keyer. I will type first, re-think the output later and hit delete. It seems I'm addicted to always doing something fast.

Anyways, I have to tap the delete button very often. Is there a way to do a backspace to word boundary that's native?

In a chat box, I can use alt+shift+left to get a word, cmd shift left to get the whole line, etc. but I can't do that in a python shell for example.

Any ideas?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

⌥⌫ (option-delete) deletes a word backward and ⌥⌦ (option-forward delete) a word forward in most text views.

M-delete deletes a word backward and M-d a word forward by default in readline. You can duplicate the OS X shortcuts by using option as a meta key and assinging ⌥⌦ to \033d.

You can also define new shortcuts by creating ~/Library/KeyBindings/ and saving a property list like this as DefaultKeyBinding.dict.

{
    "~z" = (selectParagraph:, delete:);
    "~u" = (moveToBeginningOfParagraphAndModifySelection:, cut:);
    "~k" = (moveToEndOfParagraphAndModifySelection:, cut:);
    "@\UF728" = deleteToEndOfLine:;
}
share|improve this answer
    
That's amazing!! Thank you! –  Yuji Tomita Oct 11 '12 at 21:21
add comment

The combinations you suggested are native, but not all programs are equipped to work with them, and thus the combination is ignored.

Nothing really that can be done about it except encourage the developer to program it into the app you're using.

Same goes for Windows users. The combinations work in the OS itself as well as most programs equipped to deal with them, but occasionally, programs will ignore the combinations. Usually this occurs in places were text selection is considered a secondary idea such as terminal shells and command prompts.

share|improve this answer
    
So no native CTRL+Backspace === 4 backspaces, or anything like that? –  Yuji Tomita Oct 11 '12 at 19:04
    
alas, no. You could get some third party hot key programs and make something. I'm not a daily OSX user but in windows I accomplish that with Autohotkey but I'm sure you could get something similar for OSX such as Keymando. –  Jared Tritsch Oct 11 '12 at 19:10
add comment

In OS X's terminal, you can generally use Emacs keystrokes. It's likely you can do ESC Backspace to do word-based delete. Anything that supports the readline library will accept it (including bash and python from my testing).

To make it easier, go into the Terminal settings, select Settings, Keyboard, and click Use Option as Meta Key. Then you can hit Alt-Backspace and delete back a word.

Take a google for GNU Readline to learn more about how you can configure this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.