@nextjournal/clojure-mode
v0.3.3
Published
Enabling a decent Clojure/Script editor experience in the browser. Built for and by [Nextjournal](https://nextjournal.com/).
Downloads
507
Readme
Clojure/Script mode for CodeMirror 6
Enabling a decent Clojure/Script editor experience in the browser. Built for and by Nextjournal.
✨ Features
⚡️ 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
📦 Use it in your project
Include it in your deps.edn
{: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 });
🛠 Development Setup
- Install JS dependencies:
yarn install
- Start dev server:
yarn watch
- Open the demo page at http://localhost:8002/
⚖️ License
Licensed under the EPL License, Copyright © 2020-present Nextjournal GmbH.
See LICENSE for more information.