Improve :set += -= ^= to process items individually for comma-separated options#19783
Closed
h-east wants to merge 1 commit intovim:masterfrom
Closed
Improve :set += -= ^= to process items individually for comma-separated options#19783h-east wants to merge 1 commit intovim:masterfrom
h-east wants to merge 1 commit intovim:masterfrom
Conversation
06d7f83 to
1e0960f
Compare
1e0960f to
63e0b7b
Compare
zeertzjq
reviewed
Mar 21, 2026
63e0b7b to
8b48753
Compare
zeertzjq
reviewed
Mar 22, 2026
Member
|
There may be some inconsistency here. With the default
I'm not sure if this is a problem, or if it's fine. |
Member
Author
The above behavior is a bug. I am working on fixing it.
The above results are correct, but the internal logic was flawed. I am currently working on fixing that as well.
The documentation for |
…ed options For comma-separated options with P_COLON (e.g., diffopt, listchars, fillchars), :set += -= ^= now processes each comma-separated item individually instead of treating the whole value as a single string. For :set += and :set ^=: - A "key:value" item where the key already exists with a different value: the old item is replaced. - An exact duplicate item is left unchanged. - A new item is appended (+=) or prepended (^=). For :set -=: - A "key:value" or "key:" item removes by key match regardless of value. - A non-colon item removes by exact match. This also handles multiple non-colon items (e.g., :set diffopt-=filler,internal) by processing each item individually, making the behavior order-independent. Previously, :set += simply appended the value, causing duplicate keys to accumulate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c1cca0a to
fbb45ff
Compare
Member
|
Thanks, that is a really nice improvement of the option handling. |
zeertzjq
added a commit
to zeertzjq/neovim
that referenced
this pull request
Mar 23, 2026
Problem: Option handling for key:value suboptions is limited
Solution: Improve :set+=, :set-= and :set^= for options that use
"key:value" pairs (Hirohito Higashi)
For comma-separated options with P_COLON (e.g., diffopt, listchars,
fillchars), :set += -= ^= now processes each comma-separated item
individually instead of treating the whole value as a single string.
For :set += and :set ^=:
- A "key:value" item where the key already exists with a different value:
the old item is replaced.
- An exact duplicate item is left unchanged.
- A new item is appended (+=) or prepended (^=).
For :set -=:
- A "key:value" or "key:" item removes by key match regardless of value.
- A non-colon item removes by exact match.
This also handles multiple non-colon items (e.g., :set
diffopt-=filler,internal) by processing each item individually, making
the behavior order-independent.
Previously, :set += simply appended the value, causing duplicate keys to
accumulate.
fixes: vim/vim#18495
closes: vim/vim#19783
vim/vim@e2f4e18
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeertzjq
added a commit
to zeertzjq/neovim
that referenced
this pull request
Mar 23, 2026
Problem: Option handling for key:value suboptions is limited
Solution: Improve :set+=, :set-= and :set^= for options that use
"key:value" pairs (Hirohito Higashi)
For comma-separated options with P_COLON (e.g., diffopt, listchars,
fillchars), :set += -= ^= now processes each comma-separated item
individually instead of treating the whole value as a single string.
For :set += and :set ^=:
- A "key:value" item where the key already exists with a different value:
the old item is replaced.
- An exact duplicate item is left unchanged.
- A new item is appended (+=) or prepended (^=).
For :set -=:
- A "key:value" or "key:" item removes by key match regardless of value.
- A non-colon item removes by exact match.
This also handles multiple non-colon items (e.g., :set
diffopt-=filler,internal) by processing each item individually, making
the behavior order-independent.
Previously, :set += simply appended the value, causing duplicate keys to
accumulate.
fixes: vim/vim#18495
closes: vim/vim#19783
vim/vim@e2f4e18
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeertzjq
added a commit
to zeertzjq/neovim
that referenced
this pull request
Mar 23, 2026
Problem: Option handling for key:value suboptions is limited
Solution: Improve :set+=, :set-= and :set^= for options that use
"key:value" pairs (Hirohito Higashi)
For comma-separated options with P_COLON (e.g., diffopt, listchars,
fillchars), :set += -= ^= now processes each comma-separated item
individually instead of treating the whole value as a single string.
For :set += and :set ^=:
- A "key:value" item where the key already exists with a different value:
the old item is replaced.
- An exact duplicate item is left unchanged.
- A new item is appended (+=) or prepended (^=).
For :set -=:
- A "key:value" or "key:" item removes by key match regardless of value.
- A non-colon item removes by exact match.
This also handles multiple non-colon items (e.g., :set
diffopt-=filler,internal) by processing each item individually, making
the behavior order-independent.
Previously, :set += simply appended the value, causing duplicate keys to
accumulate.
fixes: vim/vim#18495
closes: vim/vim#19783
vim/vim@e2f4e18
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeertzjq
added a commit
to neovim/neovim
that referenced
this pull request
Mar 23, 2026
…ed (#38426) Problem: Option handling for key:value suboptions is limited Solution: Improve :set+=, :set-= and :set^= for options that use "key:value" pairs (Hirohito Higashi) For comma-separated options with P_COLON (e.g., diffopt, listchars, fillchars), :set += -= ^= now processes each comma-separated item individually instead of treating the whole value as a single string. For :set += and :set ^=: - A "key:value" item where the key already exists with a different value: the old item is replaced. - An exact duplicate item is left unchanged. - A new item is appended (+=) or prepended (^=). For :set -=: - A "key:value" or "key:" item removes by key match regardless of value. - A non-colon item removes by exact match. This also handles multiple non-colon items (e.g., :set diffopt-=filler,internal) by processing each item individually, making the behavior order-independent. Previously, :set += simply appended the value, causing duplicate keys to accumulate. fixes: vim/vim#18495 closes: vim/vim#19783 vim/vim@e2f4e18 Co-authored-by: Hirohito Higashi <h.east.727@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
For comma-separated options with P_COLON (e.g., diffopt, listchars,
fillchars), :set += -= ^= now processes each comma-separated item
individually instead of treating the whole value as a single string.
For :set += and :set ^=:
the old item is replaced.
For :set -=:
This also handles multiple non-colon items (e.g., :set
diffopt-=filler,internal)
by processing each item individually, making the behavior
order-independent.
Previously, :set += simply appended the value, causing duplicate keys to
accumulate.
Fixes: #18495