This commit is contained in:
Zef Hemel
2023-01-23 18:52:17 +01:00
parent 53bf098579
commit e7728c2d2a
10 changed files with 102 additions and 27 deletions
+2 -1
View File
@@ -149,7 +149,6 @@ export class Editor {
// Runtime state (that doesn't make sense in viewState)
collabState?: CollabState;
// enableVimMode = false;
constructor(
space: Space,
@@ -332,6 +331,7 @@ export class Editor {
}
});
// Need to find a nicer way of doing this stuff
if (this.builtinSettings.fontFamily) {
document.getElementById("sb-root")!.setAttribute(
"style",
@@ -1067,6 +1067,7 @@ export class Editor {
useEffect(() => {
this.rebuildEditorState();
this.dispatchAppEvent("editor:modeswitch");
}, [viewState.uiOptions.vimMode]);
useEffect(() => {
+5 -1
View File
@@ -1,5 +1,5 @@
import { Editor } from "../editor.tsx";
import { EditorView, Transaction } from "../deps.ts";
import { EditorView, Transaction, Vim, vimGetCm } from "../deps.ts";
import { SysCallMapping } from "../../plugos/system.ts";
import { FilterOption } from "../../common/types.ts";
@@ -164,6 +164,10 @@ export function editorSyscalls(editor: Editor): SysCallMapping {
value,
});
},
"editor.vimEx": (_ctx, exCommand: string) => {
const cm = vimGetCm(editor.editorView!)!;
return Vim.handleEx(cm, exCommand);
},
};
return syscalls;