Thursday, November 27, 2025

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

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

--
--
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+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/DEK4ZLV11BG1.1RLBRTW3XDGNW%40web.de.

No comments: