Skip to content

matchparen.vim incorrectly assumes hl id 3 is available #1785

@justinmk

Description

@justinmk

Sometimes when moving quickly through some code after saving or swapping buffers, this error occurs:

Error detected while processing function <SNR>29_Highlight_Matching_Pair: 
line  140: 
E801: ID already taken: 3

In runtime/plugin/matchparen.vim, s:Highlight_Matching_Pair() calls matchdelete(3) at the start of that function but that is skipped under certain conditions.

Some other plugin may call matachadd(..., 3) or :3match, and then matchparen.vim tries to use that hl id anyway.

This could be fixed by storing the next available hl id in w:paren_hl_on instead of always using 3, then matchdelete(w:paren_hl_on).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions