Tuesday, September 30, 2025

Re: Shell Syntax Highlighting - Group bashAdminStatement

The syntax highlighting problems I've faced in the past are with syntaxes that I can't limit to a specific part of a file, such as a markdown file that has a code region in it. The problem syntaxes use the "extend" keyword when they define a region. The "extend" keyword overrides the "keepend" keyword which lets the syntax highlighting continue past the end of the code region. The c.vim, perl.vim, and vim.vim syntaxes all had this problem last I looked at it.
On Thursday, September 18, 2025 at 1:56:06 PM UTC-5 Björn Försterling wrote:
Hello,

ok, I will look into it.

Regards
Björn

On Wed Sep 17, 2025 at 10:31 PM CEST, Christian Brabandt wrote:
> Hi,
> It's not only that, it's also that certain commands (ls cat chmod) are
> only highlighted, if this is a detected bash or ksh script. I think we
> should move those to just Statements.
>
> We don't have a shell runtime file maintainer anymore and I assume
> changing this breaks some existing syntax tests. However, if you'd like
> to give it a try and unify kshStatements with bashStatement and
> bashAdminStatements (for the commands) and possibly keep those status
> keywords then please submit a PR at the Vim repo and please have a look
> at failing syntax tests (we probably just need to regenerate them).
>
> Thanks,
> Chris
>
> On Mi, 17 Sep 2025, 'Björn Försterling' via vim_use wrote:
>
>> Thank you for the answer.
>>
>> The words "daemon", "reload", "restart", "start", "status", and "stop" are
>> neither bash keywords nor external commands.
>> Maybe they were implemented for init scripts, but these are hardly used
>> anymore today.
>>
>> The words "killall", "killproc", and "nice" are external commands which is
>> ok I guess.
>> But I can't really see a pattern why some external programs are
>> highlighted and others are not.
>> They were probably selected on how frequently they are used in bash
>> scripts.
>>
>> For example if you type "systemctl start foo", then "start" is
>> highlighted, but "systemctl" is not.
>> Or for "systemctl daemon-reload" nothing will be highlighted.
>>
>> For external commands you could choose only coreutils or don't highlight
>> external commands at all.
>>
>> On Tue Sep 16, 2025 at 9:39 PM CEST, Christian Brabandt wrote:
>> >
>> > On Di, 16 Sep 2025, 'Björn Försterling' via vim_use wrote:
>> >
>> >> Hello,
>> >>
>> >> I am wondering about the syntax group "bashAdminStatement" in "runtime/syntax/sh.vim".
>> >> The syntax highlighting for these words seems unfitting.
>> >>
>> >> syn keyword bashAdminStatement daemon killall killproc nice reload restart start status stop
>> >>
>> >> Maybe these were designed for init scripts or systemd commands.
>> >> Of course I can disable this syntax group in my own syntax files.
>> >>
>> >> But does someone know why these were implemented?
>> >
>> > So is the problem, that those are not really bash specific builtins but
>> > rather external commands? I suppose the same is true for bashStatement
>> > then.
>> >
>> > Thanks,
>> > Christian
>>
>
> Mit freundlichen Grüßen
> Christian

--
--
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/1e24e20b-3b1e-4243-934c-32afedbf979fn%40googlegroups.com.

No comments: