Fix Enter for vim mode (#1146)
This is a workaround for https://github.com/replit/codemirror-vim/issues/182 Fixes https://github.com/silverbulletmd/silverbullet/pull/1145 (harder)pull/1150/head
parent
4457927416
commit
916c84e9c1
|
@ -2,6 +2,7 @@ import customMarkdownStyle from "./style.ts";
|
||||||
import {
|
import {
|
||||||
history,
|
history,
|
||||||
indentWithTab,
|
indentWithTab,
|
||||||
|
insertNewlineAndIndent,
|
||||||
isolateHistory,
|
isolateHistory,
|
||||||
standardKeymap,
|
standardKeymap,
|
||||||
} from "@codemirror/commands";
|
} from "@codemirror/commands";
|
||||||
|
@ -367,7 +368,18 @@ export function createKeyBindings(client: Client): Extension {
|
||||||
...createCommandKeyBindings(client),
|
...createCommandKeyBindings(client),
|
||||||
...createSmartQuoteKeyBindings(client),
|
...createSmartQuoteKeyBindings(client),
|
||||||
...closeBracketsKeymap,
|
...closeBracketsKeymap,
|
||||||
...client.ui.viewState.uiOptions.vimMode ? [] : standardKeymap,
|
...client.ui.viewState.uiOptions.vimMode
|
||||||
|
? [
|
||||||
|
// Workaround for https://github.com/replit/codemirror-vim/issues/182;
|
||||||
|
// without this, Enter does nothing for ordinary paragraphs in insert
|
||||||
|
// mode.
|
||||||
|
{
|
||||||
|
key: "Enter",
|
||||||
|
run: insertNewlineAndIndent,
|
||||||
|
shift: insertNewlineAndIndent,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: standardKeymap,
|
||||||
...completionKeymap,
|
...completionKeymap,
|
||||||
indentWithTab,
|
indentWithTab,
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue