Package: vim
Version: 1:7.0-122+1etch3
Severity: minor
Tags: patch

Vim's syntax highlighting for shell scripts marks certain parameter
expansion patterns as errors when in /bin/sh mode, but allows them for
/bin/bash.  Some of those patterns are valid posix /bin/sh, for example

${parameter%word}
${parameter%%word}
${parameter#word}
${parameter##word}

These are accepted for /bin/bash, but highlighted as errors for /bin/sh.
The attached patch allows these patterns for /bin/sh scripts as well.

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.18-4-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages vim depends on:
ii  libacl1                2.2.41-1          Access control list shared library
ii  libc6                  2.3.6.ds1-13etch2 GNU C Library: Shared libraries
ii  libgpmg1               1.19.6-25         General Purpose Mouse - shared lib
ii  libncurses5            5.5-5             Shared libraries for terminal hand
ii  vim-common             1:7.0-122+1etch3  Vi IMproved - Common files
ii  vim-runtime            1:7.0-122+1etch3  Vi IMproved - Runtime files

vim recommends no packages.

-- no debconf information
--- /usr/share/vim/vim70/syntax/sh.vim  2007-08-29 04:00:27.000000000 -0700
+++ /ext/home/vineet/.vim/syntax/sh.vim 2007-11-06 21:43:33.000000000 -0800
@@ -367,24 +367,26 @@
 
 " Special ${parameter OPERATOR word} handling: {{{1
 " sh ksh bash : ${parameter:-word}    word is default value
+" sh ksh bash : ${parameter-word}    word is default value
 " sh ksh bash : ${parameter:=word}    assign word as default value
+" sh ksh bash : ${parameter=word}    assign word as default value
 " sh ksh bash : ${parameter:?word}    display word if parameter is null
+" sh ksh bash : ${parameter?word}    display word if parameter is null
 " sh ksh bash : ${parameter:+word}    use word if parameter is not null, 
otherwise nothing
-"    ksh bash : ${parameter#pattern}  remove small left  pattern
-"    ksh bash : ${parameter##pattern} remove large left  pattern
-"    ksh bash : ${parameter%pattern}  remove small right pattern
-"    ksh bash : ${parameter%%pattern} remove large right pattern
+" sh ksh bash : ${parameter+word}    use word if parameter is not null, 
otherwise nothing
+" sh ksh bash : ${parameter#pattern}  remove small left  pattern
+" sh ksh bash : ${parameter##pattern} remove large left  pattern
+" sh ksh bash : ${parameter%pattern}  remove small right pattern
+" sh ksh bash : ${parameter%%pattern} remove large right pattern
 syn cluster shDerefPatternList contains=shDerefPattern,shDerefString
 syn match shDerefOpError       contained       ":[[:punct:]]"
 syn match  shDerefOp   contained       ":\=[-=?]"      [EMAIL PROTECTED]
 syn match  shDerefOp   contained       ":\=+"  [EMAIL PROTECTED]
-if exists("b:is_bash") || exists("b:is_kornshell")
- syn match  shDerefOp  contained       "#\{1,2}"       [EMAIL PROTECTED]
- syn match  shDerefOp  contained       "%\{1,2}"       [EMAIL PROTECTED]
- syn match  shDerefPattern     contained       "[^{}]\+"       
contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape
 nextgroup=shDerefPattern
- syn region shDerefPattern     contained       start="{" end="}"       
contains=shDeref,shDerefSimple,shDerefString,shCommandSub 
nextgroup=shDerefPattern
- syn match  shDerefEscape      contained       '\%(\\\\\)*\\.'
-endif
+syn match  shDerefOp   contained       "#\{1,2}"       [EMAIL PROTECTED]
+syn match  shDerefOp   contained       "%\{1,2}"       [EMAIL PROTECTED]
+syn match  shDerefPattern      contained       "[^{}]\+"       
contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape
 nextgroup=shDerefPattern
+syn region shDerefPattern      contained       start="{" end="}"       
contains=shDeref,shDerefSimple,shDerefString,shCommandSub 
nextgroup=shDerefPattern
+syn match  shDerefEscape       contained       '\%(\\\\\)*\\.'
 syn region shDerefString       contained       matchgroup=shOperator start=+'+ 
end=+'+         contains=shStringSpecial
 syn region shDerefString       contained       matchgroup=shOperator start=+"+ 
skip=+\\"+ end=+"+      [EMAIL PROTECTED],shStringSpecial
 syn match  shDerefString       contained       "\\["']"

Reply via email to