2

the delete line function in the on Mac is assigned to ^ + + k. I've a two questions:

  1. How can I reassign this action to + D?
  2. Follow-up with the first one, is there a convenient way of browsing existing command and assigned keyboard shortcuts?

I would be obliged if the answer would provide a comprehensive extract keymap.cson file and/or any other files that have to be modified to make this work.

2 Answers 2

5

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:

  1. Open settings, click on Keybindings and type delete-line. Words are usually separated by a single dash, though there are exceptions such as newline.

  2. 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!

1
  • It's not working for me it's showing "Duplicate key 'cmd-d'", what I should do here? Nov 20, 2017 at 6:50
0

Found another discussion and adding the following to the keymap (Atom > Keymap) did the trick for me in Atom 1.34.0 :

'.platform-darwin atom-text-editor':
  'cmd-d': 'editor:delete-line'

You must log in to answer this question.

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