[vim/vim] runtime(kitty): prevent kittyMapSeq from leaking into subsequent lines (PR #20422)

2 views
Skip to first unread message

bbnolauv

unread,
Jun 3, 2026, 12:23:58 PM (yesterday) Jun 3
to vim/vim, Subscribed

Problem

When kitty_mod (or a map command with no inline action) is defined at the end of a line without a trailing space (for example: kitty_mod ctrl+shift), the kittyMapSeq region fails to terminate on that line.

This happens because Vim's \s matches spaces and tabs but not newlines, meaning the current ending pattern end="\ze\s\|^\ze[ \t]*\\" cannot be triggered at the end of the line. As a result, the region leaks into subsequent lines, corrupting the syntax highlighting of the next map definitions (e.g., highlighting map as kittyKey instead of kittyMapName).

Solution

Added \|\ze$ to the end pattern of kittyMapSeq:

syn region kittyMapSeq start="\S" end="\ze\s\|^\ze[ \t]*\\\|\ze$" ...

This allows the region to terminate correctly at the end of the line (zero-width match before $) without consuming the newline character, leaving it to be handled by the parent region (like kittyMod) to close safely.

How to reproduce

  1. Add the following to kitty.conf (ensuring no trailing space at the end of the first line):
    kitty_mod ctrl+shift
    map kitty_mod+enter launch
  2. Without this fix, the map on the second line is incorrectly highlighted as kittyKey (Special). With this fix, it is correctly highlighted as kittyMapName (Function).

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

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

Commit Summary

  • cc4b1bb Fix regex for kittyMapSeq region

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20422@github.com>

Christian Brabandt

unread,
Jun 3, 2026, 1:50:12 PM (yesterday) Jun 3
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20422)

thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20422/c4615217744@github.com>

Reply all
Reply to author
Forward
0 new messages