diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts index 689067f79..ae0cfc4b0 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/CodeMirror/utils/useKeymap.ts @@ -145,6 +145,7 @@ export default function useKeymap(CodeMirror: any) { 'Alt-Right': 'goLineEnd', 'Ctrl-Backspace': 'delGroupBefore', 'Ctrl-Delete': 'delGroupAfter', + 'Ctrl-Enter': 'insertLineAfter', 'fallthrough': 'basic', }; @@ -167,6 +168,7 @@ export default function useKeymap(CodeMirror: any) { 'Alt-Backspace': 'delGroupBefore', 'Alt-Delete': 'delGroupAfter', 'Cmd-Backspace': 'delWrappedLineLeft', + 'Cmd-Enter': 'insertLineAfter', 'fallthrough': 'basic', }; diff --git a/packages/editor/CodeMirror/createEditor.ts b/packages/editor/CodeMirror/createEditor.ts index 89745e6e0..2d8076d9b 100644 --- a/packages/editor/CodeMirror/createEditor.ts +++ b/packages/editor/CodeMirror/createEditor.ts @@ -29,6 +29,7 @@ import { selectionFormattingEqual } from '../SelectionFormatting'; import configFromSettings from './configFromSettings'; import getScrollFraction from './getScrollFraction'; import CodeMirrorControl from './CodeMirrorControl'; +import insertLineAfter from './editorCommands/insertLineAfter'; const createEditor = ( parentElement: HTMLElement, props: EditorProps, @@ -261,6 +262,10 @@ const createEditor = ( }), keyCommand('Tab', insertOrIncreaseIndent, true), keyCommand('Shift-Tab', decreaseIndent, true), + keyCommand('Mod-Enter', (_: EditorView) => { + insertLineAfter(_); + return true; + }, true), ...standardKeymap, ...historyKeymap, ...searchKeymap, ]),