Repository navigation
fix(editorconfig): "[!seq]" glob matches seq instead of excluding it - #42648
Merged
Merged
Conversation
justinmk
reviewed
Nov 2, 2026
| 'g' | ||
| ) | ||
| -- EditorConfig negates a character class with "[!seq]", Vim with "[^seq]". | ||
| glob1 = vim.fn.substitute(glob1, '\\\\\\@<!\\[!', '[^', 'g') |
Member
There was a problem hiding this comment.
gsub() ...? and [=[...]=] to reduce the escaping
Contributor
Author
There was a problem hiding this comment.
Done, it uses gsub() with a [=[...]=] pattern now. Same results as the substitute() version for [!a], \[!a], [![!b] and a[!b][!c], and the editorconfig tests pass.
Member
Problem: EditorConfig uses "[!seq]" for a negated character class, but glob2regpat() keeps the "!" literal, so "[!a]" matches "a" or "!" and nothing else. For example, a "[checks/[!.]*]" section only applies to dotfiles in "checks/", the opposite of what it says. Solution: Convert "[!" to "[^" before calling glob2regpat(). AI-assisted
b84330808
force-pushed
the
editorconfig-negated-class
branch
from
November 2, 2026 10:18
004b8bb to
0cc6f58
Compare
justinmk
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
EditorConfig uses
[!seq]for a negated character class (https://spec.editorconfig.org/#glob-expressions), butglob2regpat()keeps the!literal, so[!a]matchesaor!and nothing else. For example, Checkmk's.editorconfighas a[checks/[!.]*]section, which Nvim applies only to dotfiles inchecks/, the opposite of what it says.Solution
Convert
[!to[^before callingglob2regpat(). Added a"[!seq]" glob excludes seqcase totest/functional/plugin/editorconfig_spec.lua; it fails without the change and passes with it.AI-assisted: this change was written with an AI coding agent.