Not able to add new "Ctrl-Enter Cmd+Enter" combination


I’m trying to configure codemirror to perform special action when clicking:

  • Shift-Enter
  • Cmd-Enter on mac or Ctrl-Enter on PC

I tried a lot of combination of extraKeys but nothing works for “Ctrl-Enter Cmd+Enter”:

        extraKeys: {
          'Shift-Enter': (cm) => {
            console.log('This works normally')
          'Ctrl-Enter Cmd-Enter': (cm) => {
            console.log('This is called... sometimes')

The Ctrl-Enter Cmd-Enter is called “sometimes”… I can’t understand when/why.

If I remove one of the bindings, like simply putting there ‘Cmd-Enter’ it works, so my idea is a problem of normalization. but calling CM.normalizeKeyMap change nothing.

Finally I tried using extraKeys with not luck (this is not working for a simple binding neither).

What I’m missing?


This binds the key chord of first pressing Ctrl-Enter and then Cmd-Enter, which I guess is not what you wanted. Add multiple binding properties for the different keys instead.


Thanks @marijn… I misunderstood the documentation I see.