Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
codemirror-helix
Advanced tools
A Codemirror plugin for Helix keybindings and general UX.
npm install codemirror-helix
import { EditorView } from "@codemirror/view";
import { helix, commands } from "codemirror-helix";
const customCommands = commands.of([
{
name: "save",
aliases: ["s", "sv"],
help: "Save the document to the cloud",
handler(view, args) {
saveDocumentToCloud(view.state.doc.toString());
},
},
]);
const view = new EditorView({
doc: "",
extensions: [helix(), customCommands],
parent: document.querySelector("#editor"),
});
This plugin only augments the behavior of a single editor element, a single "tab". Some Helix commands, however, only make sense in a "project" context, where
there are multiple files to edit, search, etc. The externalCommands
facet allows you to define callbacks for these multi-editor commands:
import { EditorView } from "@codemirror/view";
import { helix, externalCommands } from "codemirror-helix";
const view = new EditorView({
doc: "",
extensions: [
helix(),
externalCommands.of({
file_picker() {
showFilePicker();
},
global_search(input: string) {
seachProjectAndShowResults(input);
},
// ...
}),
],
parent: document.querySelector("#editor"),
});
In a multi-editor setup, you will probably need to sync some global state between editors (for instance, the values of the registers). You can either:
snapshot()
) and pass it as initial state to helix()
, orglobalStateSync()
and dispatch them into another editor.See the code for the playground in demo/main.ts
for an example of a multi-editor setup.
FAQs
Helix bindings for CodeMirror
The npm package codemirror-helix receives a total of 13 weekly downloads. As such, codemirror-helix popularity was classified as not popular.
We found that codemirror-helix demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.