Clojure/Script mode for CodeMirror 6
Enabling a decent Clojure/Script editor experience in the browser. Built for and by Nextjournal.
⚡️ Lightning-fast thanks to lezer incremental parsing
- Try pasting
clojure/core.clj
into the live demo.
🥤 Slurping & 🤮 Barfing
- Forward: Ctrl + ← / → or Mod + ⇧ + J / K
- Backward: Ctrl + Alt + ← / →
💗 Semantic Selections
- Expand/Contract: Alt + ↑ / ↓ or Mod + 1 / 2
🧙 Prepared for evaluation
- At Cursor: Mod + ⏎
- Top-level form: Mod + ⇧ + ⏎
- Cell: Alt + ⏎
🧹 Autoformatting following Tonsky’s Better Clojure Formatting
🎹 And lots of more useful key bindings
{:deps {io.github.nextjournal/clojure-mode {:git/sha "<SHA>"}}}
Use it from NPM
import { default_extensions, complete_keymap } from '@nextjournal/clojure-mode';
import { EditorView, drawSelection, keymap } from '@codemirror/view';
import { EditorState } from '@codemirror/state';
let extensions = [keymap.of(complete_keymap),
...default_extensions
];
let state = EditorState.create({doc: "... some clojure code...",
extensions: extensions });
let editorElt = document.querySelector('#editor');
let editor = new EditorView({state: state,
parent: editorElt,
extensions: extensions });
- Install JS dependencies:
yarn install
- Start dev server:
yarn watch
- Open the demo page at http://localhost:8002/
Licensed under the EPL License, Copyright © 2020-present Nextjournal GmbH.
See LICENSE for more information.