Atom Packages Directory

a package directory for a text editor of the 21st Century


Install with:
    apm install parinfer

Parinfer for Atom

A Parinfer package for Atom.

What is Parinfer?

Parinfer is a text editing mode that can infer Lisp code structure from indentation (and vice versa). A detailed explanation of Parinfer can be found here.

Put simply: the goal of Parinfer is to make it so you never have to think about “balancing your parens” when writing or editing Lisp code. Just indent your code as normal and Parinfer will infer the intended paren structure.


  1. Install Atom
  2. In Atom, pull up the Settings tab by pressing Ctrl+, (Cmd+, on Mac) or using the main menu Edit –> Preferences
  3. Click on the Install tab
  4. Search for “parinfer” and find this package
  5. Press the Install button :)


File Extensions

Once the package has been installed, it will automatically load in the background when you open Atom and watch for file extensions found in a config file. The default file extensions are listed here.

You can edit these file extensions by going to Packages –> Parinfer –> Edit File Extensions in the menu.

Opening a File

When a file with a recognized extension is first opened, Parinfer runs Paren Mode on the entire file and one of three things will happen (in order of likelihood):

Running Paren Mode is a necessary first step before Indent Mode can be safely turned on. See Fixing existing files for more information.

If you do not want to be prompted when opening a new file, the prompts can be disabled via config file.

Please be aware that - depending on the indentation and formatting in your Lisp files - this initial processing may result in a large diff the first time it happens. Once you start using Indent Mode regularly, this initial processing is unlikely to result in a large diff (or any diff at all). You may even discover that applying Paren Mode to a file can result in catching very hard-to-find bugs in your existing code! As usual, developers are responsible for reviewing their diffs before a code commit :)

Hotkeys and Status Bar

Command Windows/Linux Mac
Turn on / Toggle Mode Ctrl+( Cmd+(
Turn off Ctrl+) Cmd+)

The status bar will indicate which mode you are in or show nothing if Parinfer is turned off.

If you are in Paren Mode and Parinfer detects unbalanced parens (ie: code that will not compile), the status bar text will be red. Note that this will never happen in Indent Mode because Parinfer ensures that parens are always balanced. Also note that there is a known bug with this feature due to the “parent expression” hack explained below.

Dim Trailing Parens

As of Atom 1.9, inferred closing parens are dimmed in Indent Mode:

less atom-text-editor.indent-mode-76f60::shadow { span.punctuation.section.end.trailing.clojure { opacity: 0.4; // <-- desired opacity of trailing parens } }

Adding this feature to other language packages for Lisp can be done by porting the extra style classes that we added to language-clojure.

Known Limitations

This extension uses a hack for performance reasons that may act oddly in certain circumstances. It assumes that an open paren followed by an alpha character - ie: regex ^\([a-zA-Z] - at the start of a line is the beginning of a new “parent expression” and tells the Parinfer algorithm to start analyzing from there until the next line that matches the same regex. Most of the time this is probably a correct assumption, but might break inside multi-line strings or other non-standard circumstances. This is tracked at Issue #9; please add to that if you experience problems.

Future Features

Future features include:

More options and configuration settings are planned for future releases. Browse the issues for an idea of future features. Create a new issue if you can think of a useful feature :)

Plugin Development Setup

```sh # clone this repo to your homedir cd ~ git clone

symlink the repo to the Atom packages folder

ln -s ~/atom-parinfer ~/.atom/packages/

compile CLJS files

lein cljsbuild auto ```

Then run Atom on a Lisp file. Some development notes:


ISC License

Keywords: parinfer, paredit, clojure, clojurescript, cljs, lisp Suggest keywords
Fork me on GitHub