#+TITLE: Parinfer layer

#+TAGS: layer|misc

* Table of Contents                     :TOC_5_gh:noexport:
- [[#description][Description]]
  - [[#features][Features:]]
- [[#install][Install]]
  - [[#prerequisites][Prerequisites]]
  - [[#dotfile][Dotfile]]
- [[#configuration][Configuration]]
- [[#key-bindings][Key bindings]]

* Description
This layer provides an implementation of [[https://shaunlebron.github.io/parinfer/][parinfer]], a lisp editing paradigm that
controls indentation based on parentheses or vice versa.

** Features:
- Automatic management of parenthesis in Clojure, Emacs Lisp, Common Lisp and
  Scheme following the parinfer editing paradigm.
- Powered by a native library in the background

* Install
** Prerequisites
- This layer requires =parinfer-rust= library being installed. See [[https://github.com/eraserhd/parinfer-rust#installing][here]] for the
  dependencies.
- The =parinfer-rust-mode= package requires Emacs compiled with dynamic module
  support, which can be verified by existence of =MODULES= in the variable
  =system-configuration-features=.
- Currently, ony *nix system is supported.

** Dotfile
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =parinfer= to the existing =dotspacemacs-configuration-layers= list in this
file.

#+BEGIN_SRC emacs-lisp
  (setq-default dotspacemacs-configuration-layers '(pdf))
#+END_SRC

* Configuration
This package comes pre-configured to auto install the native library in your
=spacemacs-cache-directory=. If you don't want this, see [[https://github.com/justinbarclay/parinfer-rust-mode#option-2-building-library-from-sources][here]] for a manual
install option.

=parinfer-rust-mode= operates under [[https://github.com/justinbarclay/parinfer-rust-mode#modes][three modes]]. By default, it starts in
=smart-mode=, and can be toggled via =SPC t P=.

* Key bindings

| Key binding | Description                                         |
|-------------+-----------------------------------------------------|
| ~SPC t P~   | Toggle between parinfer smart indent and paren mode |
