How can I change the keymap to have Delete Line working with cmd-d?


#1

On my keymap.cson file I am trying:

'.editor':
  'cmd-d': 'editor:delete-line'

But it doesn’t seem to be working. Any idea?

Thanks!


#2

There is some helpful information here:


#3

Thanks @leedohm for pointing me into the right direction.

On the mentioned article it talks out about the Keybinding Resolver:

cmd-shift-p + Keybinding Resolver: Toggle

With that panel open, and reproducing the cmd-d I saw another keybinding was taking preference above the one I was writting, so I just needed to change it to:

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

And now it works! :smile:

Thanks again!


#4

Unfortunately this did not work for me, I have tried to use cmd-delete to fire the same command:

'.platform-darwin .editor':
    'cmd-delete': 'editor:delete-line'

The keybinding resolver still only reports:

editor:backspace-to-beginning-of-line   .editor

#5

Nevermind, figured it out. cmd-backspace was what I’m after.
The above post didn’t work either since it also needed ‘backspace’ instead of delete.

I’m using the wired mac keyboard, so even though they key says “delete” it’s actually backspace.

Hope this helps somebody.


#6

I think this setting has broken in 1.1.0 , as this no longer works :angry:


#7

The .editor selector has been deprecated for a long time. You may want to change it to atom-text-editor? Also, if you’re not on OS X, .platform-darwin should be replaced with the proper platform selector.


#8

I realize this.

'.platform-darwin .atom-text-editor':
  'cmd-backspace': 'unset!'
  'cmd-delete': 'unset!'
  'cmd-backspace': 'editor:delete-line'
  'cmd-delete': 'editor:delete-line'

Here are the settings tried.


#9

.editor is a class … atom-text-editor is an element. Try removing the period before atom-text-editor in your example.


#10

That does help, but it doesn’t seem to work consistently. Especially when

'.platform-darwin atom-text-editor':
  'cmd-backspace': 'unset!'
  # 'cmd-delete': 'unset!'
  'cmd-backspace': 'editor:delete-line'
  # 'cmd-delete': 'editor:delete-line'


#11

I’m getting ready to head into a meeting, I’ll take a look at it when I get out and see if I can help figure it out.


#12

I’ll try an make an animated gif.


#13

this worked for me. thanks.


#14

Sorry for dropping the ball, I used just this and it seems to work properly and consistently:

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

#15

Yeah I haven’t seen the transient bug lately; 1.20 might have fixed it.