Double newline on Enter key in HTML and few related languages


#1

Title basically - when I press enter in html, php or any other source related to html syntax atom inserts second new line (two \n instead of one \n).

Not suprisingly after starting to write this message I’ve finally found the cause of a problem, it was emmet package and it’s command emmet:insert-formatted-line-break-only. I’ve figured it out after checking how editor:newline command was behaving from command palette and found out that atom can issue multiple commands on single keybind resulting in both editor’s and emmet’s newline commands firing at once creating two newlines.
It might have been forked emmet package from github but I’m pretty sure it was some bug with emmet’s intendent behaviour.

I’m leaving this one here for future reference and folks like me who for the life of them couldn’t figure why the hell enter was behaving like that.
Key notes:

  1. Atom’s keybing can fire multiple commands (actions)
  2. Check your suspicion by executing command directly from pallet Ctrl+P to test if it misbehaves or just collides with another keybind.

I’ve just removed keybind from emmet’s cson for now, but would like to hear how to disable some package’s commands or keybinds completely in case emmet updates on me sometime in the future restoring default keybinding.


#2

Open Settings -> Packages, search for the package in question, click on its button, and scroll down to the Keybindings section.


#3

Oh, thanks! But doesn’t it disable ALL keybinds for a package?

A way to disable some, like newline-r for this one case, would be perfect, but you can just copy-paste keybinds to your profile and leave it at that, so that’s not a big problem. Again, thanks for the tip.


#4

That’s what you asked for. If you want to selectively re-add keybindings, you can do it in your keymap.cson file as normal. The setting just determines whether or not Atom should load the package’s keymap.