[vim/vim] select breaks syntax highlighting in bash (Issue #14795)

19 views
Skip to first unread message

DarioDarko

unread,
May 17, 2024, 2:17:16 PM5/17/24
to vim/vim, Subscribed

Steps to reproduce

set filetype to sh or bash
use 'select' as a command argument without surrounding quotes
watch the syntax highlighting break

example:

while true
do
	anycommand select something
done

i randomly discovered this because copyq has a select argument, that i use in a script

Expected behaviour

'select' should not break the syntax highlighting if its used as an argument for a command. the syntax recognition logic should only trigger if its at the very beginning of the line, after && semicolon etc

Version of Vim

9.1.0408-1

Environment

EndeavourOS
Alacritty

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795@github.com>

Christian Brabandt

unread,
May 18, 2024, 2:59:01 AM5/18/24
to vim/vim, Subscribed

I don't see this. Can you please verify using vim --clean
grafik.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2118669027@github.com>

DarioDarko

unread,
May 18, 2024, 5:53:55 AM5/18/24
to vim/vim, Subscribed

vim --clean

image.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2118749747@github.com>

Christian Brabandt

unread,
May 18, 2024, 6:20:23 AM5/18/24
to vim/vim, Subscribed

Hm, did you use bash initially? I only see this when using bash in the shebang line.
This seems to happen when the syntax script determines a bash script, because bash "knows" select name [ in word ] ; do list ; done, which the syntax script tries to match here. And since there is a missing do here, it matches the done with an error. You can workaround this by setting :let b:is_posix=1.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2118763860@github.com>

DarioDarko

unread,
May 18, 2024, 7:37:45 AM5/18/24
to vim/vim, Subscribed

yes normally i use bash, but for me this happens with sh as well

btw this does not only affect select. same with while, until, for, etc


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2118792618@github.com>

Christian Brabandt

unread,
May 18, 2024, 8:44:26 AM5/18/24
to vim/vim, Subscribed

btw this does not only affect select. same with while, until, for, etc

Yeah, for the same reason, you are using reserved words which the syntax script tries to match against the expected syntax.

:let b:is_posix=1

So does this help?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2118812662@github.com>

DarioDarko

unread,
May 19, 2024, 6:08:13 PM5/19/24
to vim/vim, Subscribed

Yeah, for the same reason, you are using reserved words which the syntax script tries to match against the expected syntax.

yes, i understand the issue. wouldt it be pretty simple to fix that in the syntax script?

So does this help?
unfortunately no
image.png (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2119374428@github.com>

Christian Brabandt

unread,
May 20, 2024, 8:30:37 AM5/20/24
to vim/vim, Subscribed

You need to reload the file after :let b:is_posix=1 using :e!, otherwise setting the buffer local var happens too late.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14795/2120365724@github.com>

Reply all
Reply to author
Forward
0 new messages