diff --git a/plugs/core/core.plug.yaml b/plugs/core/core.plug.yaml index 0cc19f98..c31d0232 100644 --- a/plugs/core/core.plug.yaml +++ b/plugs/core/core.plug.yaml @@ -26,6 +26,11 @@ functions: path: "./editor.ts:toggleDarkMode" command: name: "Editor: Toggle Dark Mode" + centerCursor: + path: "./editor.ts:centerCursorCommand" + command: + name: "Editor: Center Cursor" + key: "Ctrl-Alt-l" clearPageIndex: path: "./page.ts:clearPageIndex" events: diff --git a/plugs/core/editor.ts b/plugs/core/editor.ts index 59b22a3d..11782bc0 100644 --- a/plugs/core/editor.ts +++ b/plugs/core/editor.ts @@ -37,3 +37,8 @@ export async function foldAllCommand() { export async function unfoldAllCommand() { await editor.unfoldAll(); } + +export async function centerCursorCommand() { + const pos = await editor.getCursor(); + await editor.moveCursor(pos, true); +}