[vim/vim] runtime(vim): correctly handle ! attribute for augroup/doautocmd/doautoall (PR #14906)

20 views
Skip to first unread message

Christian Brabandt

unread,
Jun 3, 2024, 3:57:46 PM6/3/24
to vim/vim, Subscribed

…toall

I noticed that

:autocmd! FooBar
:augroup! FooBar

looks slightly different to how the ! is drawn. While the ! for the autocmd case is shown in the same color as autocmd, for :augroup is is shown as VimEventList

In addition, the vim syntax seems to accept doautocmd! and doautoall! (with bang attribute) even so this is not valid.

So let's fix all of those and mark the ! as an error for the the :doautocmd/doautoall case.

cc @dkearns


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

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

Commit Summary

  • e9282d2 runtime(vim): correctly handle ! attrubute for augroup/doautocmd/doautoall

File Changes

(6 files)

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

dkearns

unread,
Jun 4, 2024, 6:37:50 AM6/4/24
to vim/vim, Subscribed

Thanks. We need to match vimAutoEventList after a ! so I'd add a dedicated bang group for autocmds like the following.

--- vim.vim     2024-06-04 13:18:27.530178121 +1000
+++ /tmp/vim2.vim       2024-06-04 20:20:11.472645559 +1000
@@ -565,8 +565,9 @@
 if !exists("g:vimsyn_noerror")
  syn match     vimAutoBangError        contained       "!"     skipwhite nextgroup=vimAutoEventList
 endif
-syn keyword    vimAutoCmd      au[tocmd]       skipwhite       nextgroup=vimAugroupBang,vimAutoEventList
+syn keyword    vimAutoCmd      au[tocmd]       skipwhite       nextgroup=vimAutoCmdBang,vimAutoEventList
 syn keyword    vimAutoCmd      do[autocmd] doautoa[ll] skipwhite nextgroup=vimAutoBangError,vimAutoEventList
+syn match      vimAutoCmdBang  contained       "\a\@1<=!"      skipwhite nextgroup=vimAutoEventList
 syn match      vimAutoCmdMod   "\(++\)\=\(once\|nested\)"      skipwhite nextgroup=vimAutoCmdBlock
 syn region     vimAutoCmdBlock contained       matchgroup=vimSep start="{" end="}" contains=@vimDefBodyList
 
@@ -1106,6 +1107,7 @@
  hi def link vimAugroupError   vimError
  hi def link vimAugroupKey     vimCommand
  hi def link vimAutoCmd        vimCommand
+ hi def link vimAutoCmdBang    vimBang
  hi def link vimAutoEvent      Type
  hi def link vimAutoCmdMod     Special
  hi def link vimBang   vimOper

Patch on top of your 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/14906/c2147199943@github.com>

dkearns

unread,
Jun 4, 2024, 7:10:06 AM6/4/24
to vim/vim, Subscribed

I also found a stash attempting to fix a number of issues with :au. I'll see what I can salvage...


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

Christian Brabandt

unread,
Jun 5, 2024, 7:05:00 AM6/5/24
to vim/vim, Subscribed

do you want to take over this one then? Or shall I squash your patch on top of mine and go ahead merging?


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

dkearns

unread,
Jun 10, 2024, 3:19:55 PM6/10/24
to vim/vim, Subscribed

I can take it if you're not in a hurry for the intermediate fix.


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

Christian Brabandt

unread,
Jun 13, 2026, 4:17:38 PM (10 hours ago) Jun 13
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#14906)

closing as stalled


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

Reply all
Reply to author
Forward
0 new messages