mini.pairs decides whether to auto-close from one character on each side of the cursor, so going back to wrap existing text (e.g. adding backticks around some-name mid-sentence) always inserted a stray closer. This adds lua/smart_pairs.lua, which gates the opener keys with full-line context. Closers, <BS> and <CR> stay with mini.pairs.
Pairing rules (([{"'`)
A closer is only added when the rest of the line is empty/whitespace, or starts with )]} (nesting inside an existing pair).
Quotes don't pair after a word character (don't) or after the same quote (""" stays 3); nothing pairs after \.
Stepping over a matching closer and <BS> on an empty pair work as before.
Markdown fences (` and ~)
The 3rd character on a blank line opens a fence pair — only outside an existing block, and only with a blank line, EOF, or the enclosing block's closer below.
Further characters lengthen both fences (````, `````); <BS> shrinks them, and the closer goes away once the opener drops below 3.
A length-aware fence stack replaces the old parity count, so ``` lines inside a ```` (or ~~~) block no longer confuse it.
Nested examples inside a longer block get their own closers; a nested pair that grows long enough to close the enclosing block collapses into that closer.
The inline Markdown backtick block in lua/plugins.lua is replaced by require("smart_pairs").setup(), and the README's Mini.pairs entry is updated.
Testing
Headless keystroke suite (61 cases) driving the real mappings: wrapping words, EOL/whitespace/nested pairing, quotes, backslash, BS, fence open/close/lengthen/shrink, ~~~, nested ````/`````/~~~ blocks, collapse-into-closer, and typing a full nested Markdown example from scratch. All pass.
Full config loads headlessly with the mappings active and no errors.
## Summary
mini.pairs decides whether to auto-close from one character on each side of the cursor, so going back to wrap existing text (e.g. adding backticks around `some-name` mid-sentence) always inserted a stray closer. This adds `lua/smart_pairs.lua`, which gates the opener keys with full-line context. Closers, `<BS>` and `<CR>` stay with mini.pairs.
### Pairing rules (`(` `[` `{` `"` `'` `` ` ``)
- A closer is only added when the rest of the line is empty/whitespace, or starts with `)` `]` `}` (nesting inside an existing pair).
- Quotes don't pair after a word character (`don't`) or after the same quote (`"""` stays 3); nothing pairs after `\`.
- Stepping over a matching closer and `<BS>` on an empty pair work as before.
### Markdown fences (`` ` `` and `~`)
- The 3rd character on a blank line opens a fence pair — only outside an existing block, and only with a blank line, EOF, or the enclosing block's closer below.
- Further characters lengthen both fences (` ```` `, ` ````` `); `<BS>` shrinks them, and the closer goes away once the opener drops below 3.
- A length-aware fence stack replaces the old parity count, so ` ``` ` lines inside a ` ```` ` (or `~~~`) block no longer confuse it.
- Nested examples inside a longer block get their own closers; a nested pair that grows long enough to close the enclosing block collapses into that closer.
The inline Markdown backtick block in `lua/plugins.lua` is replaced by `require("smart_pairs").setup()`, and the README's Mini.pairs entry is updated.
## Testing
- Headless keystroke suite (61 cases) driving the real mappings: wrapping words, EOL/whitespace/nested pairing, quotes, backslash, BS, fence open/close/lengthen/shrink, `~~~`, nested ` ```` `/` ````` `/`~~~` blocks, collapse-into-closer, and typing a full nested Markdown example from scratch. All pass.
- Full config loads headlessly with the mappings active and no errors.
mini.pairs decides from one character on each side of the cursor, so going
back to wrap existing text (e.g. backticks around a word) always inserted a
stray closer. A new lua/smart_pairs.lua gates the opener keys: a pair is only
inserted when the rest of the line is whitespace or starts with a closing
bracket; quotes also don't pair after a word character or the same quote.
Closers, <BS> and <CR> stay with mini.pairs.
Markdown fences move into the same module and get smarter:
- the 3rd ` or ~ on a blank line opens a fence pair only outside an existing
block and with a blank line, EOF or the enclosing block's closer below
- further characters lengthen both fences (````, `````); <BS> shrinks them
- a length-aware fence stack replaces parity counting, so ``` inside a ````
block (or ~~~) no longer confuses it; nested examples pair, and a pair that
grows long enough to close the enclosing block collapses into its closer
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
mini.pairs decides whether to auto-close from one character on each side of the cursor, so going back to wrap existing text (e.g. adding backticks around
some-namemid-sentence) always inserted a stray closer. This addslua/smart_pairs.lua, which gates the opener keys with full-line context. Closers,<BS>and<CR>stay with mini.pairs.Pairing rules (
([{"'`))]}(nesting inside an existing pair).don't) or after the same quote ("""stays 3); nothing pairs after\.<BS>on an empty pair work as before.Markdown fences (
`and~)````,`````);<BS>shrinks them, and the closer goes away once the opener drops below 3.```lines inside a````(or~~~) block no longer confuse it.The inline Markdown backtick block in
lua/plugins.luais replaced byrequire("smart_pairs").setup(), and the README's Mini.pairs entry is updated.Testing
~~~, nested````/`````/~~~blocks, collapse-into-closer, and typing a full nested Markdown example from scratch. All pass.