[vim/vim] runtime(swayconfig): accept bar id passed as an argument (PR #18814)

13 views
Skip to first unread message

Konstantin Pospelov

unread,
Nov 26, 2025, 3:05:05 PM (3 days ago) Nov 26
to vim/vim, Subscribed

Unlike i3, sway supports passing an optional bar id as an argument for bar.


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

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

Commit Summary

  • a976ef6 runtime(swayconfig): accept bar id passed as an argument

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/18814@github.com>

Christian Brabandt

unread,
Nov 26, 2025, 4:07:35 PM (3 days ago) Nov 26
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#18814)

ping @litoj @jamespeapen


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/18814/c3583216693@github.com>

Josef Litoš

unread,
Nov 27, 2025, 10:06:20 AM (2 days ago) Nov 27
to vim/vim, Subscribed
litoj left a comment (vim/vim#18814)

I think a couple small changes should be done:

  • the id is not a keyword, so we shouldn't be highlighting it as one
  • we already have a match for bar block without the id, therefore the id in this group should be required
  • since the id is basically any kind of text value we should account for that

My suggestion:

syn region swayConfigBarBlockAfterId  start=/{$/ end=/^\s*}\zs$/ contained contains=i3ConfigBarOpts,i3ConfigComment,i3ConfigParen,i3ConfigBindKeyword,i3ConfigColorsBlock fold keepend extend
syn match swayConfigBarId /[^{]*/ contained contains=@i3ConfigStrVar
syn region i3ConfigBarBlock matchgroup=i3ConfigKeyword start=/bar\ze [^{]/ end=/\ze{$/ contained contains=swayConfigBarId nextgroup=swayConfigBarBlockAfterId
...
hi def link swayConfigBarId                  i3ConfigString

It is a little more convoluted, but it ensures only the id is allowed to be a string or a variable and not the contents of the block, while highlighting the ID as a string by default.


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/18814/c3586350920@github.com>

Konstantin Pospelov

unread,
Nov 27, 2025, 2:09:50 PM (2 days ago) Nov 27
to vim/vim, Push

@kupospelov pushed 1 commit.

  • bac7e49 runtime(swayconfig): accept bar id passed as an argument


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18814/before/a976ef6949530e31b4898bf69bc988592e0903e0/after/bac7e491592e414484f60f75b730ac6769bdec0e@github.com>

Konstantin Pospelov

unread,
Nov 27, 2025, 2:19:09 PM (2 days ago) Nov 27
to vim/vim, Subscribed
kupospelov left a comment (vim/vim#18814)

Those are good points, thanks!

Actually, what we need here is kind of similar to other regions like input, output, or seat. The only difference is that the identifier is optional. I defined swayConfigBar and swayConfigBarIdent, and bar can now be followed by either one of them.


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/18814/c3587081057@github.com>

Josef Litoš

unread,
Nov 28, 2025, 3:34:16 AM (yesterday) Nov 28
to vim/vim, Subscribed
litoj left a comment (vim/vim#18814)

We could do it that way, but that requires other changes as well:

  • currently, the fonts keyword uses containedin to inject itself into the bar block, which doesn't work when we create a group with a different name
  • the identifier can also be a string so we shouldn't be matching by non-space but rather non-{
  • we can remove i3ConfigBarBlock from @i3ConfigTopLevelDirective and replace it with swayConfigBarBlock


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/18814/c3588374034@github.com>

Josef Litoš

unread,
Nov 28, 2025, 5:49:31 AM (yesterday) Nov 28
to vim/vim, Subscribed
litoj left a comment (vim/vim#18814)

Since the way identifiers were highlighted was a little confusing overall I decided to apply the approach here from @kupospelov to all syntax identifier across both syntax files. I updated it in the plugin repo - litoj/i3config.vim@e665b92

@kupospelov Could you please mirror it into your PR to merge those changes?


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/18814/c3588813871@github.com>

Reply all
Reply to author
Forward
0 new messages