Skip to content

Syntax highlighting error in .sh file. #19053

@er013

Description

@er013

Steps to reproduce

vim 2:9.1.1882-1 running on debian testing with kernel 6.16.9+deb14-amd64
Using following file. Initially syntax highlighting works. Now uncomment line 7. Syntax highlighting below that line changes... Comment that line 7 out again, highlighting is back in working order.

PS. it does not help if I save the changes and reopen file with :e - syntax highlighting remains broken if line 7 is uncommented.

PPS. another variant of that same line, that does NOT break syntax highlighting:
FILENAME=$(sed -r -e "s,[:/]+,\.,g" -e "s,[^a-zA-Z0-9\._]*,,g" <<<${CLEANURL}) ;

PPPS. added line 12 to show what "fixes" broken syntax highlighting from that line forward.

#!/bin/bash

TMPDIR='/dev/shm' ;
WDIR='/mnt/tmp' ;
CLEANURL='http://localhost:8077/test' ;

#FILENAME=$(sed -r -e "s#[:/]+#\.#g" -e "s#[^a-zA-Z0-9\._]*##g" <<<${CLEANURL}) ; # syntax highlighting problem, when this row is uncommented
FILENAME=$(sed -r -e 's#[:/]+#\.#g' -e 's#[^a-zA-Z0-9\._]*##g' <<<${CLEANURL}) ;
HDRFILE="${FILENAME}.hdr" ;
FULLFILENAME="${WDIR}/${FILENAME}" ;
FULLHDRFILE="${WDIR}/${HDRFILE}" ;
# " # this line un-breaks broken syntax highlighting for following lines
TMPFILENAME="${TMPDIR}/${FILENAME}" ;
TMPHDRFILE="${TMPDIR}/${HDRFILE}" ;

Expected behaviour

I would expect this line not to break syntax highlighting. Line 8 is example of that same row, just using apostrophes in sed command - this line does not break syntax highlighting. Perhaps it helps tracking that bug down.

Pictures added from before and after uncommenting line 7.

Image Image

Version of Vim

2:9.1.1882-1

Environment

OS: Debian testing, kernel 6.16.9+deb14-amd64
TERM: in different terminals:
screen.xterm-256color
xterm-color
xterm-kitty
screen
TERMINAL: tried screen 4.9.1-3 in kitty 0.44.0-1, plain kitty 0.44.0-1, plain xterm 406-1, screen 5.0.1 in kitty 0.44.0-1 - same outcome with that file.

Logs and stack traces

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions