• Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vim plugin, insert or delete brackets, parentheses, and quotes in pairs

Auto Pairs

Tests Minimum Vim version 8.1 patch 1114

Insert or delete brackets, parens, and quotes in pair: a maintained fork of jiangmiao/auto-pairs

Note to migrating users

If you're migrating from jiangmiao's version, it's highly recommended that you read :h autopairs-migrating after installing. There have been a number of breaking changes made in this fork, as well as changes to default behavior. See the migration guide for important differences that are may affect your workflow.

Installation

NOTE: Auto-pairs currently requires at least vim 8.1 with patch 1114. See #37

There's several installation methods, and you're free to use whatever you want, but I personally cannot recommend vim-plug enough, in part because of the previous line of text. Installation, if you expect a more or less working variant, should be done with:

Plug 'LunarWatcher/auto-pairs'

You can also specify a tag, but this is no longer needed as of the proper release of 3.0.0.

To use experimental changes before they're deployed, use:

Plug 'LunarWatcher/auto-pairs', {'branch': 'develop'}

Note: As of 4.0.0, let g:AutoPairsCompatibleMaps = 0 is the default. Set the variable to 1 to use jiangmiao-compatible keybinds.

Running tests (not required)

Auto-pairs comes with a few tests aimed at making sure nothing accidentally regresses without manually testing everything. Tests are in the test folder, and are in the vimspec format (using themis.vim); follow its instructions to run the tests.

Some plugins may interfere with the tests and cause erroneous failures, but the CI is generally indicative of the general state of auto-pairs. If it fails locally, that may be an indication of a plugin incompatibility (though these are often possible to fix)

Versioning system (meta)

This project roughly uses semantic versioning, with the minor exception that major version bumps may not be breaking in the sense that everything breaks, but introduces a set of features that significantly changes auto-pairs' functionality.

Breaking API changes that affect code compatibility will never happen outside major version bumps (looking aside bugs). Additionally, the master branch is the main development branch and may therefore periodically break. While I do as many tests as I can before I push, there may still be bugs introduced on the main branch. If you want a stable (ish) experience, stick to tags. If you want updates when they're released, stick to the master branch.

Differences from jiangmiao

At this point, there's far too many differences to list all of them. Aside removing some variables (such as remapping <C-h>), and tweaking defaults, many additional variables have been added. Including changes by Krasjet, here's a short list of some of the things this fork does that upstream doesn't:

  • Option for inserting pairs only if there's whitespace
  • Option for automatic linebreaks for some openers
  • Built-in support for language-specific pairs
  • Option for searching for closers after space (jiangmiao always did this, Krasjet never did this)
  • Option for entirely disabling jump
  • Option for a pre-init hook
  • Option for disabling in some directories
  • Options for single-quote handling around text
  • QOL improvements for matching
  • Balance checks with advanced modes (See :h g:AutoPairsStringHandlingMode)
  • ... Lots of bugfixes and general improvements
  • Better standards
  • Support and continued development :)

The entire list is too long to place in its entirety here -- the documentation should cover all the variables, so reading it should give you a complete idea of the changes.

Compatibility

Quite a lot of code compatibility was thrown out the window with a massive change that moved the plugin to be partially autoloaded. This mainly leads to improvements in terms of making it easier to customize (i.e. autopairs#AutoPairsDefine is available without an autocmd now). Additionally, it makes sure to reduce the chance of a conflict between functions.

Functionally, however, it's meant to resemble upstream as much as possible, partly to make migration less annoying for people with lots of customization.

Goals

  • Improving on jiangmiao's original code
  • Updating the plugin with long-requested features
  • ... and with new ones.
  • Increased customizability

Non-goals

  • Being a drop-in snippet replacement -- use UltiSnips or lexima.vim instead.
  • Supporting very old versions of Vim
  • HTML support: hardcoding HTML tags works, but writing a tag autoinserter requires substantial rewrites to the core engine. Instead, may I introduce you to Tim Pope? Or alternatively alvan?

Features

  • Obviously, the insertion and deletion of pairs (note that deletion is disabled by default. See :h g:AutoPairsMapBS)
  • An enter mapping for pair expansion
  • Quote handling aimed at avoiding accidental expansions
  • The ability to ignore pair insertion unless there's a whitespace (:h autopairs-howto-whitespace-only)
  • Extended balance checks
  • Fast pair wrapping
  • Several customisable features for various personal preferences

For more features, as well as documentation, see doc/AutoPairs.txt

Contributors

See Contributors

License

The code is licensed under the MIT license. See LICENSE.md for the full license text.

More Repositories

1

dotfiles

A collection of various primarily Linux dotfiles
Shell
20
star
2

NN-chatbot

A chatbot with a neural network, which can be used in the console, on Discord or in the Stack Exchange network chat.
Kotlin
11
star
3

se-data-dump-transformer

Part of a community-driven effort to counteract Stack Exchange's anti-community data dump changes
C++
8
star
4

LunarWatcher

7
star
5

Doge-git

Shell
6
star
6

AdventureLandCpp

C++ wrapper for https://adventure.land
C++
5
star
7

Genesis

Colony sim, because why not?
C++
5
star
8

Dragon

Automatic Stack Overflow editor
Python
4
star
9

KClassUnpacker

Kotlin
4
star
10

Acacia

Tree-sitter interface for Vim
C++
4
star
11

lunarwatcher.github.io

Source for my website
HTML
4
star
12

doesnotfail2ban

Intrustion detection system for Linux-based servers
C++
3
star
13

userscripts

Fun stuff for tampermonkey
JavaScript
3
star
14

upm

Package manager for people who need up-to-date packages
C++
3
star
15

NN-chatbot-wiki

2
star
16

Dawn

Dawn generates project structures for you in Vim, so you don't have to.
Vim Script
2
star
17

Skye.vim

Plugin for displaying GitHub issues and (some details about) pull requests inside Vim.
C++
2
star
18

stackexchange-war-machinery

Aggregation repository for automation tools in the continued fight against Stack Exchange, Inc.'s continued anti-community actions.
2
star
19

stc

C++
2
star
20

rule-nlp.cpp

C++
2
star
21

BlockerBot

Discord bot to nuke users with invites in their usernames
Python
1
star
22

DiscordWebhooks.cpp

C++
1
star
23

AoC-2018

Kotlin
1
star
24

Amber

Theme previewer for Vim
Vim Script
1
star
25

Alisha

A cross-site chatbot
Java
1
star
26

conan-IXWebSocket

Python
1
star
27

stackchat.cpp

C++20 library for interacting with Stack Exchange chat
C++
1
star
28

boson-light.cpp

C++
1
star
29

Pihole-blocklists

1
star
30

shell-scripts.sh

Shell
1
star
31

uBlock-blocklists

1
star
32

printable

C++17 table library
C++
1
star
33

helpwriter.vim

Vim Script
1
star
34

BadSOReviewsRoom

Static info for https://chat.stackoverflow.com/rooms/208985/bad-stack-overflow-reviews
1
star
35

userstyles

Making the internet look less like absolute trash
CSS
1
star