Let's start with the second part of your question, since it gives you an understanding of what we're going to do. There are two ways to find existing keybindings:
Open settings, click on Keybindings and type delete-line
. Words are usually separated by a single dash, though there are exceptions such as newline
.
Install the keybinding-resolver
and open it using the Cmd. shortcut. The resolver will display any shortcut as you type.
Both options will display the triggered command and the selector in which the shortcut is working. In our case the command is editor:delete-line
and the selector atom-text-editor:not([mini])
. We will use both when creating our custom keybinding.
Open the keymap from the menu (Atom > Keymap) or the command palette (“Application: Open Your Keymap”). I've commented a working example to explain each step:
'atom-text-editor:not([mini])':
# Unbind default Cmd-D shortcut
'cmd-d': 'unbind!'
# Assign new shortcut
'cmd-d': 'editor:delete-line'
# Optional: Unbind default editor:delete-line shortcut
'ctrl-shift-k': 'unbind!'
Hope this helps!