disable indenting

Hello! Is there a way to disable indenting completely? I am using @codemirror/lang-javascript and i’d prefer to not have any indenting when I press enter. I’ve tried indentUnit.of("") but it throws Invalid indent unit: "".
Is there another way?

You’re probably looking to just bind enter to something else than insertNewlineAndIndent (such as insertNewline).

1 Like

thank you for the tip, that worked :slight_smile:

For future readers, I was able to solve it like this keymap extension:

Prec.highest(
  keymap.of([
    /** other keymaps */
    {
      key: "Enter",
      run: (view) => {
        insertNewline(view);
        return true;
      },
    },
  ])
)
1 Like