View previous topic :: View next topic |
Author |
Message |
lars_the_bear Guru
Joined: 05 Jun 2024 Posts: 522
|
Posted: Sat Jun 22, 2024 9:32 am Post subject: Vim syntax |
|
|
Hi folks
I've noticed that after installing the Gentoo syntax extension for Vim, Vim shows lines beginning with spaces with a red background, as if to indicate some kind of error. This seems to happen with .ebuild files, and files in /etc/init.d. I'm not sure about other files, but I know that my source code is generally note affected.
If this is intentional (and I can't see why it should be, since spaces are fine there) is there a way to turn off the Gentoo syntax highlighting, without breaking anything?
BR, Lars. |
|
Back to top |
|
|
Banana Moderator
Joined: 21 May 2004 Posts: 1737 Location: Germany
|
|
Back to top |
|
|
lars_the_bear Guru
Joined: 05 Jun 2024 Posts: 522
|
Posted: Sat Jun 22, 2024 12:48 pm Post subject: |
|
|
Thanks. But do you know a way to turn it off? Or, better still, fix it? There's not much in the documentation except 'it exists'.
BR, Lars. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22664
|
Posted: Sat Jun 22, 2024 2:31 pm Post subject: |
|
|
I never noticed this, but looked into it due to your post. Ebuild files routinely have indents in their functions, and are not impacted. Examining the syntax file reveals this is because /usr/share/vim/vimfiles/syntax/ebuild.vim loads /usr/share/vim/vimfiles/syntax/gentoo-common.vim. The latter includes: /usr/share/vim/vimfiles/syntax/gentoo-common.vim: | " bad space
syn region GentooError start=/^ / end=/$/ | This causes leading space characters to be flagged as an error. It does not flag leading tabs as an error, which is why ebuild functions are not flagged. They use tabs for indenting. If I were to guess why this syntax rule exists, I would guess it is because the coding standard is to use tabs, and this rule warns people who try to use spaces there. You can avoid it by using tabs. You could add a Vim local rule to cancel that specific syntax match. |
|
Back to top |
|
|
lars_the_bear Guru
Joined: 05 Jun 2024 Posts: 522
|
Posted: Sat Jun 22, 2024 5:36 pm Post subject: |
|
|
Hu wrote: | I would guess it is because the coding standard is to use tabs, and this rule warns people who try to use spaces there. You can avoid it by using tabs. You could add a Vim local rule to cancel that specific syntax match. |
Thanks. I prefer spaces but, of course, I wouldn't want to inflict my odd ways on other people
BR, Lars. |
|
Back to top |
|
|
|