[vim/vim] Issue-11855: Fix help syntax highlighting for backtick commands with spaces and punctuation (PR #19874)

10 views
Skip to first unread message

Codecave

unread,
Mar 31, 2026, 10:06:22 AM (yesterday) Mar 31
to vim/vim, Subscribed

Problem

Backtick-enclosed commands in help files are not highlighted correctly
when they contain spaces and are followed by punctuation or whitespace.

Example:
:call code. is not highlighted
:call code . is not highlighted

However:
:callcode. is highlighted

This leads to inconsistent and unintuitive behavior.


Cause

The existing implementation uses syn match patterns with strict
boundary conditions, which:

  • do not handle spaces inside backticks reliably
  • disallow certain characters (like '.') after the closing backtick
  • depend on complex regex boundaries that fail in edge cases

Solution

Replace the match-based rules with a region-based rule:
syn region helpCommand start="" end="" keepend contains=helpBacktick

This approach:

  • correctly handles spaces inside backticks
  • allows punctuation after the closing backtick
  • simplifies the logic
  • provides consistent behavior

Testing

Manually verified:

  • :call code ✔ highlighted
  • :call code. ✔ highlighted
  • :call code . ✔ highlighted
  • :call code; ✔ highlighted

Existing behavior for other backtick patterns remains unchanged.


Notes

There is one unrelated test failure in test_buffer.vim:
Expected 'E94:' but got 'E93'

This appears to be environment-specific and unrelated to
changes in runtime/syntax/help.vim.



You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19874

Commit Summary

  • 3d79c21 Issue-11855: syntax(help): fix backtick command highlighting with spaces and punctuation

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874@github.com>

Christian Brabandt

unread,
Mar 31, 2026, 10:47:14 AM (yesterday) Mar 31
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19874)

why did you comment out parts of it? Also please create a syntax test for this change. And if you are using AI to create a PR, you need to disclose this.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/c4163199613@github.com>

Codecave

unread,
Mar 31, 2026, 2:11:23 PM (yesterday) Mar 31
to vim/vim, Push

@akarshbarar pushed 1 commit.

  • 2c117c9 Addressed Review Comments and added syntax test for the changes


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/before/3d79c2179ef5daa5db9b367fe33db0c4c37e31f7/after/2c117c9d3cde625ca7cb9a22d0830ca370c7a093@github.com>

Codecave

unread,
Mar 31, 2026, 2:19:24 PM (yesterday) Mar 31
to vim/vim, Subscribed
akarshbarar left a comment (vim/vim#19874)

why did you comment out parts of it? Also please create a syntax test for this change. And if you are using AI to create a PR, you need to disclose this.

There was an issue then we type :call code. in vim and :syntax on then the code was not highlighted, so code has fixed that issue now the code is getting highlighted as expected.
Here is the issue link #11855.

The commented code were just for fallback and should not be a part of final code. I have removed the commented code.
Yes I used AI just to understand the codebase and explore possible approach but final fix, validation and testing was done manually.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/c4164524512@github.com>

Christian Brabandt

unread,
Mar 31, 2026, 2:43:12 PM (yesterday) Mar 31
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19874)

Since this is a syntax test, it should go below runtime/syntax/testdir/. Create a new file help_examples.txt and add a few examples that previously failed. Then regenerate the dumps and verify those look actually good and then commit here.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/c4164657845@github.com>

dkearns

unread,
5:45 AM (15 hours ago) 5:45 AM
to vim/vim, Subscribed

Closed #19874.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/issue_event/24105658996@github.com>

dkearns

unread,
6:19 AM (15 hours ago) 6:19 AM
to vim/vim, Subscribed
dkearns left a comment (vim/vim#19874)

This PR is nonsense and having to plough through LLM generated babble adds insult to injury. Please don't submit PRs like this unless have a reasonable understanding of the issues and confidence in your solution, it wastes everyone's time including your own.

I don't have to look to know that this change will break highlighting in dozens of help pages, and so badly you can't have done even the most basic manual testing.

It should be blatantly obvious that the current implementation's complexity is not an accident. Bram's response to the referenced issue should also have caused you to consider the simplicity of your solution more critically. He would not have suggested a work-around if it was so trivial to fix.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/c4169037197@github.com>

Codecave

unread,
9:22 AM (11 hours ago) 9:22 AM
to vim/vim, Subscribed
akarshbarar left a comment (vim/vim#19874)

This PR is nonsense and having to plough through LLM generated babble adds insult to injury. Please don't submit PRs like this unless you have a reasonable understanding of the issues and confidence in your solution, it wastes everyone's time including your own.

I don't have to look to know that this change will break highlighting in dozens of help pages, and so badly you can't have done even the most basic manual testing.

It should be blatantly obvious that the current implementation's complexity is not an accident. Bram's response to the referenced issue should also have caused you to consider the simplicity of your solution more critically. He would not have suggested a work-around if it was so trivial to fix.

Thank you for your response being new to open source contribution i might have missed many points, but it was great learning for me and how vim works will try to lean things in depth, thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19874/c4170062817@github.com>

Reply all
Reply to author
Forward
0 new messages