Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nextjournal/clojure-mode
Clojure/Script mode for CodeMirror 6
https://github.com/nextjournal/clojure-mode
clojure clojurescript codemirror codemirror-editor codemirror6 lezer lezer-grammar
Last synced: 7 days ago
JSON representation
Clojure/Script mode for CodeMirror 6
- Host: GitHub
- URL: https://github.com/nextjournal/clojure-mode
- Owner: nextjournal
- License: epl-2.0
- Created: 2020-07-29T10:02:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T07:34:14.000Z (8 months ago)
- Last Synced: 2024-05-01T23:18:57.787Z (8 months ago)
- Topics: clojure, clojurescript, codemirror, codemirror-editor, codemirror6, lezer, lezer-grammar
- Language: Clojure
- Homepage: https://nextjournal.github.io/clojure-mode/
- Size: 12.1 MB
- Stars: 156
- Watchers: 15
- Forks: 16
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-codemirror5 - Clojure
README
# Clojure/Script mode for [CodeMirror 6](https://codemirror.net/6/)
Enabling a decent Clojure/Script editor experience in the browser. Built for and by [Nextjournal](https://nextjournal.com/).
* **[๐คนโโ๏ธ Live demo with in-browser eval](https://nextjournal.github.io/clojure-mode/)**
* [๐ข Try it in Nextjournal](https://nextjournal.com/try/clojure?cm6=1)
* [๐ฆ Use it in your project](#-use-it-in-your-project)## โจ Features
**โก๏ธ Lightning-fast thanks to [lezer incremental parsing](https://lezer.codemirror.net/)**
* Try pasting [`clojure/core.clj`](https://raw.githubusercontent.com/clojure/clojure/master/src/clj/clojure/core.clj) into the [live demo](https://nextjournal.github.io/clojure-mode/).**๐ฅค 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](https://tonsky.me/blog/clojurefmt/)
๐น **And lots of more useful [key bindings](https://nextjournal.github.io/clojure-mode/#keybindings)**
## ๐ฆ Use it in your project
### Include it in your `deps.edn`
```clojure
{:deps {io.github.nextjournal/clojure-mode {:git/sha ""}}}
```### Use it from [NPM](https://www.npmjs.com/package/@nextjournal/clojure-mode)
```js
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](https://github.com/nextjournal/clojure-mode/blob/master/LICENSE) for more information.