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'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

1 Answer 1

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

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.