Problem: matchparen keeps cursor on case label in sh filetype
(@categorical, after 9.1.1187).
Solution: Use :defer so that cursor is always restored, remove checks
for older Vims, finish early if Vim does not support :defer
fixes: #16887closes: #16888
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: matchparen plugin wrong highlights shell case statement
(Swudu Susuwu)
Solution: return early, if we are in a shSnglCase syntax element
The shell syntax element "case $var in foobar)" uses closing parenthesis
but there is no corresponding opening parenthesis for that syntax
element. However matchparen is not aware of such things and will happily
try to match just the next opening parenthesis.
So let's just add a way to opt out for such cases. In this case, use the
syntax state to check if the closing parenthesis belongs to the syntax
item "shSnglCase" and if it is, do not try to find a corresponding
opening parenthesis.
Since inspecting the syntax state might be expensive, put the whole
check behind a filetype test, so that matchparen will only perform this
particular check, when it knows the current buffer is a "sh" filetype.
fixes: #16801closes: #16831
Signed-off-by: Christian Brabandt <cb@256bit.org>
Set the "matchparen_disable_cursor_hl" config variable to disable
highlighting the cursor with the MatchParen highlighting group.
closes: #15984
Signed-off-by: Matteo Landi <matteo@matteolandi.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: The matchparen plugin is slow on a long line.
Solution: Don't use a regexp to get char at and before cursor.
(zeertzjq)
Example:
```vim
call setline(1, repeat(' foobar', 100000))
runtime plugin/matchparen.vim
normal! $hhhhhhhh
```
closes: #15568
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Changing buffer in another window using win_execute() causes
it to show matchparen (after 9.0.0969).
Solution: Delay highlighting with SafeState in BufWinEnter.
(zeertzjq)
closes: #14177
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: matchparen highlight not cleared in completion mode
Solution: Clear matchparen highlighting in completion mode
Remove hard-coded hack in insexpand.c to clear the :3match before
displaying the completion menu.
Add a test for matchparen highlighting. While at it, move all test tests
related to the matchparen plugin into a separate test file.
closes: #13493closes: #13524
Signed-off-by: Christian Brabandt <cb@256bit.org>
* matchparen: do not use hard-coded match id
Instead of using the hard-coded match id 3, which may also be used by
other plugins, let the matchparen plugin use whatever ids are
automatically returned when calling matchaddpos().
For backwards-compatibility, keep the `:3match` call, which will still
use the hard-coded id 3 (as mentioned in :h :3match).
closes: #13381
Signed-off-by: Christian Brabandt <cb@256bit.org>
* Dedicate upcoming Vim 9.1 to Bram
Also replace in a few more places Brams email address and mention new
maintainers.
* Remove Bram from any Maintainer role
* runtime: Align Header
* it's mailing list not mailinglist
Problem: Matchparen highlight is not updated when switching buffers.
Solution: Listen to the BufLeave and the BufWinEnter autocmd events.
(closes#11626)
Problem: The column is not restored properly when the matchparen plugin is
used in Insert mode and the cursor is after the end of the line.
Solution: Set the curswant flag. (Christian Brabandt). Also fix
highlighting the match of the character before the cursor.
Problem: Matchparen only uses the topmost syntax item.
Solution: Go through the syntax stack to find items. (James McCoy)
Also use getcurpos() when possible.
Problem: Using a regexp pattern to highlight a specific position can be
slow.
Solution: Add matchaddpos() to highlight specific positions efficiently.
(Alexey Radkov)
Problem: On some systems case of file names is always ignored, on others
never.
Solution: Add the 'fileignorecase' option to control this at runtime.
Implies 'wildignorecase'.
Problem: Matchparen does not update match when using auto-indenting.
(Marc Aldorasi)
Solution: Add the TextChanged and TextChangedI autocommand events.