How to delete current character as ctrl-d in emacs?


#1

I wanna be able to delete the current character/ the one in front of cursor, and I want it to bind to ctrl-d as in emacs.
I want to add it in my ‘keymap.cson’ file so it can overwrite all other bindings of ctrl-d.

Any ideas of how I can do this? How can I possible figure out what kind of command doing what, e.g. ‘pane:show-next-item’, where do I find these?

Thanks!


#2

Have you tried using the Keybinding Resolver (Cmd+. on OS X and Ctrl+. on other platforms)? It will show you what key Atom saw you press and the command that was triggered because of it.

You could use this to find out the command executed when you press Delete, then you could use that to map keys to.


#3

Thanks, didn’t know that.
But it still doesn’t work.

This is what i putt in keymap file:

'body':
  'ctrl-d': 'unset!'
  'ctrl-d': 'core:delete'

Can I in some way super force it? :stuck_out_tongue:


#4

The keybinding you placed in your message simply unmaps and remaps Ctrl+D to core:delete. Did you mean to use some other key? What OS are you running? Is Ctrl+D mapped to something else?


#5

I got some mapping from emmet thats I’m trying to unmap before mapping it. Done that before for another key combination, which worked.

I’m running mac os x. And yes it is mapped for some wierd shit from emmet plugin.


#6

You don’t need to unmap something just to map it again. What you need to do is use the selector from the Emmet keybinding and the mapping from your example above.


#7

Here’s the selector emmet is currently using:

'.platform-darwin atom-text-editor:not([mini])':
  'ctrl-d': 'emmet:balance-outward'

So (if I understood correctly) the mapping on keymap.cson should look like:

'.platform-darwin atom-text-editor:not([mini])':
  'ctrl-d': 'core:delete'

#8

That solved it, thank you! :slight_smile: