= parinfer-rust
Infer parentheses for Clojure, Lisp and Scheme.
https://github.com/eraserhd/parinfer-rust
A full-featured, super fast implementation of https://shaunlebron.github.io/parinfer/[Shaun Lebron’s parinfer]. This repo has Vim, Neovim, and Kakoune plugins, and an https://github.com/justinbarclay/parinfer-rust-mode[Emacs plugin] is available. The Rust library can be called from other editors that can load dynamic libraries.
This plugin, unlike others available for Vim, implements "smart" mode. Rather than switching between "paren" mode and "indent" mode, parinfer uses information about how the user is changing the file to decide what to do.
== Installing
Dependencies:
clang
and libclang-dev
packages or equivalent for your OS=== Stand-alone CLI
If you just want to run parinfer-rust
from the command-line:
.... $ cargo build --release $ cargo install ....
If you use emacs add the corresponding feature flag during compilation .... $ cargo build --release --features emacs ....
=== Vim and Neovim
==== +pathogen+
If you are using Tim Pope’s +pathogen+
:
.... $ cd ~/.vim/bundle $ git clone git@github.com:eraserhd/parinfer-rust.git $ cd ~/.vim/bundle/parinfer-rust $ cargo build --release ....
==== +vim-plug+
Then, build project using cargo:
.... $ cd /path/to/parinfer-rust $ cargo build --release ....
Or, with optional automatic recompilation on update:
==== +lazy.nvim+
Add this to your +init.lua+
:
==== +Nix+
If you are a Nix user using Nix + Home Manager to build your vim plugins, you can add:
=== Kakoune
==== +plug.kak+
Add this to your +kakrc+
Re-source your +kakrc+
or restart Kakoune. Then run +:plug-install+
.
+plug.kak+
will download, build and install plugin for you. Optionally
add +cargo clean+
line to the +do+
block to clean plugin from build
files, thus making it load a bit faster.
==== Manual
.... $ cd ~/my-projects $ git clone git@github.com:eraserhd/parinfer-rust.git $ cd parinfer-rust $ make install $ cargo build --release $ cargo install ....
Add this to your +kakrc+
==== NixOS or nix-darwin
Alternately, you can add your plugins as an overlay:
{ nixpkgs.overlays = [ (self: super: { kakoune = super.wrapKakoune self.kakoune-unwrapped { configure = { plugins = with self.kakounePlugins; [ parinfer-rust ]; }; }; }) ];
=== Emacs
To install parinfer-rust for Emacs follow the instructions at https://github.com/justinbarclay/parinfer-rust-mode#installing[parinfer-rust-mode.el]
== Building WebAssembly
WebAssembly currently needs the ``nigthly'' toolchain:
.... $ rustup update $ rustup install nightly $ rustup target add wasm32-unknown-unknown --toolchain nightly $ cargo +nightly install cargo-web ....
It can then be built with:
.... $ cargo +nightly web build --release ....
== Tests
The CI server uses Nix to make reproducible build and test environments. It's a good idea to run tests with it.
.... $ nix-build release.nix # Build and test everything $ cargo test # Run the native tests $ cargo +nightly web test # Test the WebAssembly version $ vim --clean -u tests/vim/run.vim # Test against locally-installed Vim $ ( cd tests/kakoune && ./run.sh ) # Test against locally-installed Kakoune $ nix-build release.nix -A vim-tests # Test against Nix Vim package $ nix-build release.nix -A neovim-tests # Test against Nix Neovim package $ nix-build release.nix -A kakoune-tests # Test against Nix Kakoune package ....
Vim tests are in a nice, readable format in +tests/vim/test-cases.md+
.
Please add tests for any new features (or even old ones!).
You can set the +VIM_TO_TEST+
environment variable to Vim’s path to test weird or different builds.
== Contributors
This wouldn’t be possible without the work of others:
== License
link:LICENSE.md[ISC License]