Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've grown accustomed to pressing Cmd-D to delete the entire line of text that I'm editing in Eclipse.

I can't seem to find a way to add this command to other Mac programs. Can this be done?

I do know about Cmd-Backspace and Ctrl-K but I want to delete the entire line, regardless of the position of the cursor and including the CR/LF at the end.

share|improve this question
up vote 1 down vote accepted

Create or modify ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
    "$\U007F" = (selectParagraph:, delete:); // $\U007F = shift-delete
}

The changes will be applied after reopening apps or logging out and back in. Custom keybindings don't work in some cross platform applications (like Eclipse, Netbeans, Firefox and Photoshop), but they do in most native ones.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .