Bug#818137: symtax highlighting for ft=sh gets confused by filename with -case- in it

Josh Triplett josh at joshtriplett.org
Mon Mar 14 05:15:08 UTC 2016


Package: vim
Version: 2:7.4.963-1+b2
Severity: normal

Given a file containing the following:

"""
#!/bin/sh
if true; then
    echo Something
fi

apply_patch make-some-case-work

if true; then
    echo Something
fi

apply_patch make-some-esac-work

if true; then
    echo Something
fi
"""

vim will highlight the 'case' in 'make-some-case-work' as though a keyword.
Its parser then gets confused, such that it highlights the second 'fi' in red
as an error.  vim will do the same for the closing brace of a function, or the
'done' of a loop.  A subsequent 'esac' (even if in the middle of a filename)
will get the syntax highlighting back into the right state.  (Conversely, a use
of 'esac' other than as a shell construct, without vim already in this confused
state from a 'case', will get highlighted in red as though an error.)

Other keywords, like 'if' and 'while', get highlighted in the middle of
filenames or similar but don't seem to confuse the parser in the same way.

- Josh Triplett

-- Package-specific info:

--- real paths of main Vim binaries ---
/usr/bin/vi is /usr/bin/vim.basic
/usr/bin/vim is /usr/bin/vim.basic

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages vim depends on:
ii  libacl1      2.2.52-3
ii  libc6        2.22-3
ii  libgpm2      1.20.4-6.1+b2
ii  libselinux1  2.4-3+b1
ii  libtinfo5    6.0+20160213-1
ii  vim-common   2:7.4.963-1+b2
ii  vim-runtime  2:7.4.963-1

vim recommends no packages.

Versions of packages vim suggests:
pn  ctags        <none>
pn  vim-doc      <none>
ii  vim-scripts  20130814

-- no debconf information



More information about the pkg-vim-maintainers mailing list