Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

parinfer-rust

> 编程语言
Open source

A Rust port of parinfer.

624 stars0 likes1 views
WebsiteGitHub

About

A Rust port of parinfer.

= 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:

  • https://www.rust-lang.org/en-US/install.html[rust] >= ~1.83 ?
  • 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

==== +vim.pack+ (Neovim >= 0.12)

[source,lua]

vim.api.nvim_create_autocmd('PackChanged', { callback = function(ev) local name, kind = ev.data.spec.name, ev.data.kind if name == 'parinfer-rust' and (kind == 'install' or kind == 'update') then vim.system({ 'cargo', 'build', '--release' }, { cwd = ev.data.path }) end end, })

vim.pack.add { 'https://github.com/eraserhd/parinfer-rust' }

==== +pathogen+

If you are using Tim Pope’s +pathogen+:

.... $ cd ~/.vim/bundle $ git clone [email protected]:eraserhd/parinfer-rust.git $ cd ~/.vim/bundle/parinfer-rust $ cargo build --release ....

==== +vim-plug+

[source,viml]

Plug 'eraserhd/parinfer-rust'

Then, build project using cargo:

.... $ cd /path/to/parinfer-rust $ cargo build --release ....

Or, with optional automatic recompilation on update:

[source,viml]

Plug 'eraserhd/parinfer-rust', {'do': \ 'cargo build --release'}


If you are a NixOS user using Plug, you can use this command instead: [source,viml]

Plug 'eraserhd/parinfer-rust', {'do': \ 'nix-shell --run "cargo build --release "'}


==== +lazy.nvim+

Add this to your +init.lua+:

[source,viml]

require("lazy").setup({ {"eraserhd/parinfer-rust", build = "cargo build --release"} })

==== +Nix+

If you are a Nix user using Nix + Home Manager to build your vim plugins, you can add:

[source,nix]

programs.neovim = { [ pkgs.vimPlugins.parinfer-rust ];

}

=== Kakoune

==== +plug.kak+

Add this to your +kakrc+

[source,kak]

plug "eraserhd/parinfer-rust" do %{ cargo install --force --path . } config %{ hook global WinSetOption filetype=(clojure|lisp|picolisp|racket|scheme) %{ parinfer-enable-window -smart }

}

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 [email protected]:eraserhd/parinfer-rust.git $ cd parinfer-rust $ make install $ cargo build --release $ cargo install ....

Add this to your +kakrc+

[source,kak]

hook global WinSetOption filetype=(clojure|lisp|picolisp|racket|scheme) %{ parinfer-enable-window -smart

}

==== NixOS or nix-darwin

[source,nix]

{ environment.systemPackages = let myKakoune = pkgs.wrapKakoune pkgs.kakoune-unwrapped { configure = { plugins = with self.kakounePlugins; [ parinfer-rust ]; }; }; in [ myKakoune ];

}

Alternately, you can add your plugins as an overlay:

[source,nix]

{ nixpkgs.overlays = [ (self: super: { kakoune = super.wrapKakoune self.kakoune-unwrapped { configure = { plugins = with self.kakounePlugins; [ parinfer-rust ]; }; }; }) ];

environment.systemPackages = [ pkgs.kakoune ]; }

=== 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 flake check # Build and test everything $ 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 ....

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:

  • Shaun Lebron - Inventing parinfer and doing the math.
  • Case Nelson - Writing the nvim-parinfer, from which VimL code and some inspiration was stolen.
  • Justin Barclay - Emacs module.
  • Michael Camilleri - User-defined comments.
  • Mitsuhiro Nakamura - Support for Common Lisp and Scheme.
  • ElKowar - User-defined string-delimiters and support for Yuck.
  • Graham Enos - Updating Rust edition
  • Sunjay Cauligi - Support for Hy

== License

link:LICENSE.md[ISC License]

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustclojurekakounelispparinfer

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言