[vim/vim] syntax(sh): missing shRedir shOperator (Issue #20680)

0 views
Skip to first unread message

dezza

unread,
1:22 PM (7 hours ago) 1:22 PM
to vim/vim, Subscribed
dezza created an issue (vim/vim#20680)

Steps to reproduce

Screenshot 1:
IMG_5158.png (view on web)

Screenshot 2:
IMG_5159.png (view on web)

Snippet:

#!/usr/bin/env bash

if ((EUID != 0)); then
	printf '%s\n' "you must be root!" >&2
fi

((EUID != 0)) && printf '%s\n' "you must be root!" >&2

Expected behaviour

shRedir highlight group in bottom pipe to stderr (‘>&2`)

Version of Vim

9.2

Environment

from irc

Logs and stack traces

09:32 <ursa> Where can I paste an image to illustrate a question about syntax highlighting?
09:41 <ursa> Why is the '2' highlighted differently in the two cases? https://ibb.co/yB5Xyt8K
09:56 <bata> uhm
09:57 <bata> of what I remember, bash highlighting had some troubles
09:57 <bata> there were some options to set, but I don't know if they are going to be of use to you
09:57 <bata> let me check
09:59 <bata> nope.
09:59 <bata> :h ft-bash-syntax
10:12 <ursa> Thanks, is this something where I should report a bug, or is it just a known unfixable (or too hard to fix) problem?
10:15 <dza> ursa: please do
10:19 <dza> it looks inconsistent and the syntax looks almost equal except the bottom is after && not knowing whats b4, but inconsistency is definetily a bug
10:20 <ursa> I see vim is on github, which I do not use, please file the bug yourself if you still think it's worth reporting.
10:21 <dza> please give sample for reproduce in 
#vim
RIP Bram | Can't talk? Register https://libera.chat/guides/registration | Vim 9.1 https://www.vim.org | Don't ask to ask! | Use :help and :helpgrep | PASTE: https://dpaste.com/?syntax=vim | WIKI: https://vim.wikia.com
19:29 <qf> https://paste.debian.net/plainh/35ad18ad
19:29 <qf> This mapping gives me error. Am I using line continuation correctly?
19:32 <stanrifkin> qf: works for me
19:32 <stanrifkin> qf: What's the error message?
19:44 <rindolf> qf: can you extract a function?
19:49 <qf> stanrifkin: E488: Trailing characters: nnoremap <Leader>c :let @+ = @0<CR> elseif
19:49 <qf> and so on until endif
19:53 <qf> Also syntax highlighting stops after line with first mapping
20:05 <stanrifkin> qf: tried :list already?
20:08 <stanrifkin> qf: I'm not seeing it right now
20:09 <dza> no E488 as pasted for me either
20:12 <qf> https://paste.debian.net/hidden/e3ff8515
20:12 <qf> This simplified version gives me error as well
20:13 <qf> E488: Trailing characters: echo 'foo' endif
20:23 <qf> https://paste.debian.net/plainh/35e4a426
20:25 <qf> vimscript is tricky
21:28 <dza> qf: either way you need | at the end of first 2 lines
21:28 <dza> the line continuation only makes it continue same line so you still need | as separation of commands
21:41 <dza> its kind of similar to how it works in shell if you did command grouping like { line1; line2; } instead if 1 | foo | endif
07:28 <qf> dza: Thank you. After adding pipe separators everything works now
22:02 <mivanchev> hey, can anyone recommend me a good plugin to align C macro slashes on tab stops ?
22:02 <mivanchev> i know i can write some code quickly =)
22:03 <lopid> i don't know what that means exactly but https://github.com/tommcdo/vim-lion#readme is decent for aligning things
22:03 *** mathsaey (~mathsaey@user/mathsaey) has quit (Quit: mathsaey)
22:04 <mivanchev> lopid: i use easy-align which is the same but it doesn't align on tab stops, it aligns on first-suitable common column
22:04 <mivanchev> which seems to be 1 whitespace after last alpha char
22:05 <mivanchev> oh, this supports disabled sqeezing
22:05 <mivanchev> thanks lopid, that will do :)
09:32 <ursa> Where can I paste an image to illustrate a question about syntax highlighting?
09:41 <ursa> Why is the '2' highlighted differently in the two cases? https://ibb.co/yB5Xyt8K
09:56 <bata> uhm
09:57 <bata> of what I remember, bash highlighting had some troubles
09:57 <bata> there were some options to set, but I don't know if they are going to be of use to you
09:57 <bata> let me check
09:59 *** dr_kokobas (~Thunderbi@user/dr-kokobas:29317) has quit (Quit: dr_kokobas)
09:59 <bata> nope.
09:59 <bata> :h ft-bash-syntax
10:12 <ursa> Thanks, is this something where I should report a bug, or is it just a known unfixable (or too hard to fix) problem?
10:15 <dza> ursa: please do
10:19 <dza> it looks inconsistent and the syntax looks almost equal except the bottom is after && not knowing whats b4, but inconsistency is definetily a bug
10:20 <ursa> I see vim is on github, which I do not use, please file the bug yourself if you still think it's worth reporting.
10:21 <dza> please give sample for reproduce in text
10:23 *** ingenarel (~ingenarel@user/ingenarel) [ingenarel] (ingenarel) has joined the channel
10:23 <ursa> https://bpa.st/JLPA
10:24 <bata> the first subject gets highlighted as: >&2 gets highlighted as shTestOper shOperator shNumber
10:24 <bata> the second gets highlighted all as shOperator
10:25 <bata> sorry, the second is: shRedir shOperato shOperator
10:25 <ursa> shTestOper is wrong, yes?
10:25 <bata> I don't even know what that is xD
10:26 <bata> for me bash test should be the square brackets?
10:26 <dza> yes
10:26 <bata> I guess that should be shRedir like the second subject
10:27 <dza> [ ] is essentially shorthand for test(1)
10:27 <dza> except its a builtin, faster
10:27 <bata> now, if the number '2' should be operator or number that I don't know
10:27 <dza> I think you nailed the issue bata
10:34 <bata> good xD. I only noticed it because of the highlighting in my theme: https://ibb.co/w9fDj5x


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20680@github.com>

Reply all
Reply to author
Forward
0 new messages