[runtime/c] How to Set c_gnu in vim9script?

21 views
Skip to first unread message

Björn Försterling

unread,
Nov 28, 2025, 2:07:43 AMNov 28
to vim...@googlegroups.com
Hello,

In a .c file in the following line, the character is categorized as
"cSpecialError".
```
char my_char = '\e';
```
(This is a valid character (27) on my machine.)

It seems to be this section in runtime/syntax/c.vim:
```
83 if exists("c_gnu")
84 syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
85 syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
86 else
87 syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
88 syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
89 endif
```

And "c_gnu" is not set.

I tried setting "c_gnu" in "~/.vim/after/syntax/c.vim" (which is
currently vim9script).

This would not work because the scope is local to the vim script:
```
var c_gnu = 1
```

Can someone please help me how to set this variable?
And shouldn't the variable be set by default on GNU/Linux machines?

Regards
Bjoern

Ben Yip

unread,
Nov 28, 2025, 2:13:36 AMNov 28
to 'Björn Försterling' via vim_use
g:c_gnu = 1
>--
>--
>You received this message from the "vim_use" maillist.
>Do not top-post! Type your reply below the text you are replying to.
>For more information, visit http://www.vim.org/maillist.php
>
>---
>You received this message because you are subscribed to the Google Groups "vim_use" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
>To view this discussion visit https://groups.google.com/d/msgid/vim_use/DEK4ZLV11BG1.1RLBRTW3XDGNW%40web.de.

Björn Försterling

unread,
Nov 28, 2025, 11:08:43 AMNov 28
to vim...@googlegroups.com
Ok, I had to put it in ~/.vimrc because ~/.vim/after/syntax/c.vim gets
sourced too late.

Thank you.
Reply all
Reply to author
Forward
0 new messages