
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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
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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.