Saturday, August 29, 2009

vim 7.1 - sh.vim syntax file - unwarranted syntax error detected.

From the kdb package in debian lenny:

$ cat /etc/init.d/console-screen.kbd.sh

1 #!/bin/sh

[some comments snipped..]

17 PKG=kbd
18 if [ -r /etc/$PKG/config ]; then
19 . /etc/$PKG/config
20 fi
21
22 if [ -d /etc/$PKG/config.d ]; then
23 for i in `run-parts --list /etc/$PKG/config.d `; do
24 . $i
25 done
26 fi
27
28 # do some magic with the variables for compatibility with the config
29 # file of console-tools
30 for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed
's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
31 ..

[..]

Syntax highlighting after line 30. colors the rest of the script mostly
red - which I understand is the color used to highlight a syntax error,
but the script executes without any problems.

I believe I am using the "default" color scheme on an xterm with a black
background.

It seems things start to go wrong just after the "for vc in" statement
so it looks like either the two single quotes followed by a back quote
or possibly, the regex following the "grep" is causing the problem.

Or maybe it is the bash + sed syntax mix?

I have seen some issues with back quotes, though nothing conclusive, and
I was wondering if the $VIMRUNTIME/syntax/sh.vim maintainer was aware of
this issue?

Maybe it has been addressed or circumvented in a more recent version of
the syntax file?

Or if this is caused by a "syntax mix", is there a way to tell vim not
to report this type of error?

I'm attaching a clean copy of the entire script to this message.

Gen-Paul.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: