codemirror-kakoune-cm5
v0.5.0
Published
Kakoune-style modal editing for CodeMirror 5.
Maintainers
Readme
CodeMirror Kakoune CM5
CodeMirror 5 adapter over the shared kakoune-core-js engine, adhering to CodeMirror 5's native keyMap architecture.
Installation
npm install codemirror-kakoune-cm5 codemirror@^5.65.0
# or
pnpm add codemirror-kakoune-cm5 codemirror@^5.65.0Or via JSR:
npx jsr add @ykmade/codemirror-kakoune-cm5Quick Start
import CodeMirror from "codemirror";
import { kakoune } from "codemirror-kakoune-cm5";
const editor = CodeMirror(document.querySelector("#editor"), {
lineNumbers: true,
tabSize: 2
});
kakoune(editor, {
initialMode: "select",
onWhichKey: (pending, items) => {
// Optional hook for which-key UI
},
onPrompt: prompt => {
// Optional hook for regex select (s) / split (S) UI
}
});Key Features
- Motions:
h j k l,w b e,W B E,0 $,g h/l/k/j/g,G h/l/k/j/g/G,count+G - Selections & Lines:
x(select line),%(select all),<A-j>(join lines),<A-J>(join lines & select spaces),_(trim whitespace) - Transformations:
~(uppercase),`(lowercase),<A->` (swap case) - Edits:
d(delete),c(change),y(yank),p(paste after),P(paste before),o(open below),O(open above),<A-o>/<A-O>(empty lines) - Regex & Search:
s(select matches),S(split selection) - History:
u(undo),U(redo)
License
MIT
