Skip to content

Alternate file in vimscript occasionally breaks syntax highlighting #13047

@acc987

Description

@acc987

Steps to reproduce

  1. Open $VIMRUNTIME/**/defaults.vim and navigate to where the DiffOrig command is defined.
  2. In r ++edit #, the alternate file # and the trailing text is highlighted as a comment, see attached screenshot below.

AlternateBufferSyntaxHighlighting

Expected behaviour

I expect the use of # not to break syntax highlighting in this case.

I'm assuming that highlighting breaks because comments=sO:# -,mO:# ,eO:##,:#,sO:" -,mO:" ,eO:"",:" is set by the vim.vim ftplugin, most likely due to Vim9Script, but that does not necessarily have to be the root cause as syntax highlighting still works correctly in, for example, nnoremap <silent> ,b :buffer! #<CR>. So I guess this is more of a syntax parsing issue than an issue with the way 'comments' is set. I have not been able to make any progress beyond that and would appreciate it, if someone familiar with the code base could look into this.

Version of Vim

9.0.1632

Environment

Operating system: openSUSE Leap

Logs and stack traces

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions