Cannot rebind "enter" key keybinding for editor use, please help

Hi there. For the purposes of help, Please know that I am a beginner with coding and atom and usually just use it for writing prose / other off-label usage.

I am attempting to rebind the ‘enter’ key so that instead of inserting a new line, it inserts

in my keymaps file, I have attempted to use both

‘atom-text-editor’:
‘enter’: ‘editor:

and

‘atom-workspace atom-text-editor:not([mini])’:
‘enter’: ‘editor:

but neither gives me the desired function.It just causes the enter key to stop working.

Any thoughts on how to achieve this? It really does have to be the enter key, unfortunately. I cannot just bind this functionality to another key, although that would be easier I am sure.

Thoughts?

Oh for—

Okay. apparently the message board stripped out text.

I am attempting to rebind the ‘enter’ key so that instead of inserting a new line, it inserts
<///br> (without the’///’)
in my keymaps file, I have attempted to use both

‘atom-text-editor’:
‘enter’: ‘editor:<///br>’

‘atom-workspace atom-text-editor:not([mini])’:
‘enter’: ‘editor:<///br>’

(again, without the’///’)

It’s not stripping out text, you’re typing in a markdown / HTML aware forum. Code should be guarded in ``` like this

```
paste the code here <p>so we can see it exactly as you have it</p>
```

Does it? It would be a whole lot easier to write out the document normally, then use ctrl-f and copy one of the newlines (drag the mouse from the end of one line to the beginning of the other), paste it into the find box, and replace with <br />.

Atom doesn’t have a default "insert the text after editor:" command and I’m not sure what documentation or tutorial you’re reading that has indicated to you that it works this way. If you want to create a command such as custom:insert-br, you can. That just takes a tiny amount of code in init.coffee:

atom.commands.add 'atom-text-editor', 'custom:insert-br', ->
  atom.workspace.getActiveTextEditor().insertText('<br />')

That will drop the tag at your current cursor position. It will also make all normal enter functionality unavailable if the first matching command is that one (which it will be, since it’s in init.coffee), and that’s why I think it’s a larger hassle to make your custom command than it would be to just edit your document at the end. Additionally, you should avoid using the core namespaces for custom commands. When a command starts with editor:, that’s an indication of where it comes from and provides useful information. Your custom commands should be distinctive.

This shouldn’t be a problem with event abortion.
https://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/#overloading-key-bindings

Yes, there are ways to work around it, but then you have to figure out all the cases where the command would normally apply but you don’t want it to, and then figure out how to make Atom recognize them. Any package installed could introduce a new behavior for the key, and some of those might not have any distinguishable difference in context from the desired tag insertion. Any command that does something every time an un-modified text key is pressed inside the editor is going to be disruptive like that and potentially create undesired behavior that needs to be constantly fixed, since you can’t simply place a conditional on when the command does work, which is what the example on that page does.