diff --git a/plug-api/README.md b/plug-api/README.md index 6b4dea5d..962ccc02 100644 --- a/plug-api/README.md +++ b/plug-api/README.md @@ -1,4 +1,4 @@ This folder contains two things: * Wrappers for `syscall`s to be used by Plugs -* Reusablee library code that plugs may find useful \ No newline at end of file +* Reusable library code that plugs may find useful \ No newline at end of file diff --git a/plug-api/syscalls/editor.ts b/plug-api/syscalls/editor.ts index dd35d479..e66ecd4f 100644 --- a/plug-api/syscalls/editor.ts +++ b/plug-api/syscalls/editor.ts @@ -211,3 +211,7 @@ export function openSearchPanel() { export function copyToClipboard(data: string | Blob): Promise { return syscall("editor.copyToClipboard", data); } + +export function deleteLine() { + return syscall("editor.deleteLine"); +} diff --git a/plugs/editor/editor.plug.yaml b/plugs/editor/editor.plug.yaml index 896edb5c..162ab10f 100644 --- a/plugs/editor/editor.plug.yaml +++ b/plugs/editor/editor.plug.yaml @@ -163,6 +163,12 @@ functions: name: "Navigate: Center Cursor" key: "Ctrl-Alt-l" requireMode: rw + deleteLine: + path: "./editor.ts:deleteLineCommand" + command: + name: "Delete Line" + key: "Ctrl-d" + requireMode: rw # Debug commands parseCommand: diff --git a/plugs/editor/editor.ts b/plugs/editor/editor.ts index 54880dab..3a2eb4eb 100644 --- a/plugs/editor/editor.ts +++ b/plugs/editor/editor.ts @@ -64,3 +64,7 @@ export function undoCommand() { export function redoCommand() { return editor.redo(); } + +export function deleteLineCommand() { + return editor.deleteLine(); +} diff --git a/web/syscalls/editor.ts b/web/syscalls/editor.ts index ac478014..291abd44 100644 --- a/web/syscalls/editor.ts +++ b/web/syscalls/editor.ts @@ -6,7 +6,7 @@ import { unfoldAll, unfoldCode, } from "@codemirror/language"; -import { redo, undo } from "@codemirror/commands"; +import { deleteLine, redo, undo } from "@codemirror/commands"; import { Transaction } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; import { getCM as vimGetCm, Vim } from "@replit/codemirror-vim"; @@ -272,6 +272,9 @@ export function editorSyscalls(client: Client): SysCallMapping { context: client.getContext(), }); }, + "editor.deleteLine": () => { + deleteLine(client.editorView); + }, // Folding "editor.fold": () => { foldCode(client.editorView);