You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 20, 2020. It is now read-only.
Note: You may want to check out parinferish, which implements a parinfer-like mode in pure Clojure(Script).
Introduction
A Clojure and ClojureScript library that wraps parinfer.js and parinfer-jvm so it is accessible on both platforms with the same functions. It supplies paren-mode and indent-mode functions, both of which take the text, the cursor's x position, and the line (the latter two are zero-based).
Additionally, it provides a function called add-indent to add indentation where appropriate. It takes a map containing the text, a cursor position (a vector with two numbers representing the begin and end cursor, which are the same number if there is no selection), and the indent type. The possible indent types are :return, :forward, and :back, which should be supplied when the user types the return key, tab key, or shift+tab key respectively. Examples:
The add-indent function has an additional indent type, :normal, which you can use during all other editing actions. It will run the code through parinfer's indent mode, but when necessary it will also automatically adjust the indentation in a way that is similar to aggressive-indent-mode. You can think of it as a compromise between indent and paren mode. Example:
You can include this library in your project dependencies using the version number in the badge above.
To experiment with this library in a REPL, you can use the Clojure CLI tool. In this directory, run clj to start a Clojure REPL, or clj -A:dev -m cljs.repl.node to start a ClojureScript REPL. When the REPL is up, enter the main namespace with (require 'cross-parinfer.core) (in-ns 'cross-parinfer.core).
Licensing
All files that originate from this project are dedicated to the public domain. I would love pull requests, and will assume that they are also dedicated to the public domain.
About
A library that wraps Parinfer for Clojure and ClojureScript