Open-source project
windwp/nvim-autopairs avatar
windwp/nvim-autopairs

Five of the code blocks in nvim-autopairs' README stop mid-statement

autopairs for neovim written in lua

4,106 stars145 forksLuaMIT

At a glance

What is it?
A Neovim autopair plugin whose reference table of default values is cut off inside a comment with no closing brace, whose examples set four options that table never lists, and whose only release is tagged with a version number one higher than the release is named.
Who is it for?
nvim-autopairs suits a Neovim user who wants closing brackets inserted as they type and who reads the source rather than the readme for the configuration surface. Check five things first.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 45 days ago.
What is it written in?
Mainly Lua, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • windwp/nvim-autopairs4,106 ★ · +7
Star history
Repository2026-09-232026-11-24
windwp/nvim-autopairs4.1k4.1k

7 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Five code blocks end in the middle of a line

Count the incomplete blocks in this file and the pattern is consistent rather than accidental. The default values table stops at a line reading a boolean option set to true followed by a comment that breaks off after two letters of a word, with no closing brace, so the reference list of options is not a list you can paste. The completion plugin example stops inside a documentation comment whose parameter type is misspelled, missing both the rest of the comment and every closing brace below it. The block for one completion plugin stops in the middle of a bracket expression with nothing closed. The rules example stops after a comment that begins a sentence and never finishes. The treesitter example stops partway through the name of a condition function. A sixth block, the one illustrating a wrapping shortcut, is cut off in the source. Six of the file's code samples are fragments. The one consequence worth dwelling on is the first: a defaults table is a thing people copy, and this one cannot be, because it does not close.

The examples set four options the defaults table never reaches

The visible defaults list has nine keys. Elsewhere in the same file, four more are set. The treesitter example passes a flag that turns tree-sitter checking on and a table configuring it per language, and neither appears in the list. The example for one completion plugin passes two flags that turn off the bracket and Enter key mappings, and neither appears in the list either. So the file's own samples configure keys its own reference does not contain, which is what you would expect from a truncated table but is not stated anywhere. The Enter key is the interesting case, because the file dedicates a section to it and then gives three different configurations for it across three collapsed sections: one for the most popular completion plugin, one for a different completion plugin, and one for people running no completion plugin at all, which sets the flag to true. The completion plugin example sets it to false. So the prose implies opposite values for the same option, and the place where the default would be settled is the part of the table that is missing.

The stated minimum editor version is older than the features it documents

The requirement line says one thing and the rest of the file assumes another. It asks for version 0.7 of the editor. The file then documents tree-sitter integration with per-language node configuration, a wrapping shortcut with its own illustration, per-filetype disabling, a rules engine with composable conditions, and integration shims for three specific completion plugins. Those are not features of a 0.7-era editor. A floor that old is almost certainly a number nobody has revisited rather than a tested minimum, and it will not stop a plugin manager from installing the plugin on an old editor, where the newer features will simply fail. The release record has its own inconsistency. There is one entry, its name is 0.10.0 and its tag is 0.11.0, which is what happens when a release step bumps one file and tags another. The branch was last pushed in late August 2026, so roughly ten months of work sit on top of a release record with a single, internally inconsistent entry.

One default guard names three other plugins, and the override replaces rather than extends it

The defaults include a filetype exclusion list, and its three entries are all prompt filetypes belonging to other people's plugins: one picker, one panel, and one input. That is a defensible default, since a pairing plugin firing inside a fuzzy-finder prompt is annoying, and coupling to three specific filetype names is the standard way to do it. Two things follow. If you use a different picker, or a fourth one that did not exist when the list was written, the exclusion does not apply and pairing stays active inside its prompt. And the file's override example shows the list being replaced rather than extended, because that is how a table option works: the example sets two entries, one of which is the first plugin, and in doing so drops the other two defaults. A reader copying that line to add one filetype has silently removed two exclusions. Nothing in the file says the option is a replacement, and the example does not look like a replacement.

The examples demonstrate a narrower next-character rule than the default

There is a setting for which characters, when they sit immediately after the cursor, suppress the insertion of a closing pair. Its default is a pattern class covering alphanumerics plus eight escaped literals: percent, quote, apostrophe, open bracket, double quote, dot, backtick and dollar. The section that explains the setting, with a diagram showing what happens before and after, then demonstrates it with an override that covers only two things, alphanumerics and the dot. So the illustration shows the behaviour of a configuration almost nobody is running. A reader who reads the diagram has learned what the setting does by example, and the example is not the default. That matters most for the dot, which is in both, and for the four characters that only the default suppresses. A file that has been truncated in six places is not a reliable place to look up a default, and this is the sharpest example of why.

The close-pair check counts brackets on the current line only

One guard exists to stop the plugin adding a second closing bracket when one is already there. The rule is stated in terms of the character after the cursor: if it is a closing pair, and there is no matching open pair on the same line, the plugin declines to add one. The diagram shows a line with an open bracket, the cursor, and two closing brackets; typing an open bracket there produces a new pair inserted before them rather than a third closing bracket appearing. The heuristic is line-scoped, and that is its limit. A bracket opened on a previous line is invisible to a check that only looks at the current one, so a multi-line construct is exactly the case where the count is wrong. The file does not say this. The only escape is a boolean that turns the check off, and it is global, so a user who wants the check for one language and not another cannot express that through this setting.

The integration API hands you a list and expects you to index it

Six functions make up the runtime control surface, and the file lists them as a block with a comment beside each:

``` lua require('nvim-autopairs').disable() require('nvim-autopairs').enable() require('nvim-autopairs').toggle() require('nvim-autopairs').remove_rule('(') -- remove rule ( require('nvim-autopairs').clear_rules() -- clear all rules require('nvim-autopairs').get_rules('"') ```

Four of them are obvious. The fifth clears every rule, which is worth knowing about before you call it during a debugging session. The sixth is the interesting one, because the sample immediately after the block uses it by reaching into the returned list at a fixed position and mutating the entry there, once by assigning a field directly and once by calling a method on it. So there are two different mutation styles for the same object, and both go through a numeric index with nothing guarding it. If the list is empty, the sample raises an error rather than doing nothing. The file does not mention the possibility, and given that the rule for a given character is registered lazily, an index of one is an assumption about internal ordering rather than an API.

Three package managers, one of them not the first-party choice, and no format check

Installation is shown for three managers. The recommended-looking snippet is the lazy one, and it uses that manager's convention of deferring loading until an event and then calling the plugin's own config entry point, which is why the repository carries a Lua module the plugin manager can require for you. The other two are the venerable path-based one and a third manager shown with exactly the same weight and no note about its status, which matters because the first of the three is what its author maintains now. The build file is three targets and gets them right: all three are declared as not producing files, which is the part many comparable build files get wrong. Tests run inside a headless editor with plugins disabled, loading a minimal init file and delegating to a Busted-compatible runner, with a second target that runs one file given as a variable. Formatting is a third target that invokes a Lua formatter over the whole tree, and there is a formatter configuration and a formatter ignore file at the root. What there is not is a check mode, so nothing in the build file fails on badly formatted code.

Editorial conclusion

nvim-autopairs suits a Neovim user who wants closing brackets inserted as they type and who reads the source rather than the readme for the configuration surface. Check five things first. The table of default values is the reference the whole file points at, and it is truncated, so the option list you get is partial. Several of the file's own examples set options that table never reaches, including the two that decide whether the Enter key is remapped. The stated minimum editor version is old enough that the treesitter-based and wrap-based features cannot be assumed to work on it. One filetype guard in the defaults names three other plugins' prompt filetypes, so replacing your picker silently re-enables pairing inside it, and the override example replaces that list rather than extending it. And there is no format check target, so style is enforced by running the formatter and reading the diff.

Frequently asked questions

what is nvim autopairs

An autopair plugin for Neovim, written in Lua, that inserts the closing half of a bracket, brace, quote or other pair as you type and supports multiple characters. The readme states a minimum editor version of 0.7, and the tree carries the plugin source, a tests directory run through a headless editor, and a formatter configuration.

what does nvim autopairs do

It closes pairs as you type, moves the cursor past a closing character, adds pairs after a quote, and can check tree-sitter nodes and the surrounding line before inserting. Pairs are defined by a rules engine with composable conditions, and the Enter key behaviour is configurable for three different completion plugins.

How do I install nvim-autopairs?

The readme shows three package managers, one of which defers loading until insert mode is entered and then calls the plugin's own config entry point. The other two use a path-based install with a Lua setup call, and a third uses a function form of the same call. All three end with the same setup invocation.

How do I stop nvim-autopairs firing inside a prompt?

There is a filetype exclusion setting whose default names the prompt filetypes of three other plugins, one picker and two input widgets. The override example replaces that list rather than extending it, so adding one filetype in the way the example shows drops the other two defaults.

What options does nvim-autopairs support?

The readme's table of default values is cut off partway through, showing nine keys and stopping inside a comment with no closing brace. Four more options appear only in the file's own examples, including the tree-sitter flags and the two that decide whether the Enter and bracket keys are remapped.

How do I run the nvim-autopairs tests?

With a make target that launches the editor headless with plugins disabled, loads a minimal init file and runs a Busted-compatible directory runner over the tests. A second target runs a single file named by a variable, and a third invokes the Lua formatter over the tree. All three targets are correctly declared as not producing files.

Official sources

  1. Issues
  2. License: MIT
  3. README
  4. Releases
  5. windwp/nvim-autopairs on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/windwp-nvim-autopairs.svg)](https://hysenlabs.com/projects/windwp-nvim-autopairs)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/windwp-nvim-autopairs.svg)](https://hysenlabs.com/projects/windwp-nvim-autopairs)

Was this useful?