Shell Syntax Highlighting - Group bashAdminStatement

34 views
Skip to first unread message

Björn Försterling

unread,
Sep 16, 2025, 2:13:08 PM (10 days ago) Sep 16
to v...@vim.org
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?

Regards
Björn Försterling

Christian Brabandt

unread,
Sep 16, 2025, 3:40:05 PM (10 days ago) Sep 16
to vim...@googlegroups.com
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
--
"The number of Unix installations has grown to 10, with more expected."
-- The Unix Programmer's Manual, 2nd Edition, June, 1972

Björn Försterling

unread,
Sep 17, 2025, 2:28:17 PM (9 days ago) Sep 17
to vim...@googlegroups.com
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.

Christian Brabandt

unread,
Sep 17, 2025, 4:32:18 PM (9 days ago) Sep 17
to vim...@googlegroups.com
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
Mit freundlichen Grüßen
Christian
--
Either one of us, by himself, is expendable. Both of us are not.
-- Kirk, "The Devil in the Dark", stardate 3196.1

Björn Försterling

unread,
Sep 18, 2025, 2:56:06 PM (8 days ago) Sep 18
to vim...@googlegroups.com
Hello,

ok, I will look into it.

Regards
Björn
Reply all
Reply to author
Forward
0 new messages