On 21/10/11 15:17, Tom Bodine wrote:
I was bitten by the old
        unexpected EOF while looking for matching `"'
error in bash. Where you start a comment some where in the middle of
your script and forget to place a quote mark at the end. After
searching through the text I could not find any string that matched
this criteria. It was only when I loaded the script into SciTE that I
could see that this text was the problem

<script>
        # Syntax.........: libraryCheck [-test] {executable}
        # Parameters ....: executable - an Executable and Linkable Formated
file
                         : -test : just do the test but don't fail on error
        # Return values .: 0 on success, exits if libraries not found

</script>

Even though the third line appears as executable text to Bash, to me
it looks like part of the comment in the other lines. Vim did not help
me here since it colors the line starting with the colon the same as
the line starting with the hash mark. In order  to find the problem I
loaded the script into Scite.

Where as Scite treats lines starting with colons correctly and leaves
them colored like regular text, Vim colors them the same as comments
( those lines wich start with hash marks).

How can I change Vim's syntax coloring to treat lines starting with
colons differently from those starting with hash marks?

Thanks and Regards Tom Bodine


In bash (as can be seen with "help :" without the quotes at the bash prompt) : is a do-nothing command. So it can be regarded as legitimate to treat it as a comment. Actually, in the current $VIMRUNTIME/syntax/sh.vim (version 118 dated Aug 16, 2011 and applying to all three of sh, bash and ksh) these "colon lines" are set to syntax group shColon at line 287, then at line 536 the shColon highlight group is linked to shComment which is in turn linked to Comment at line 612.

So a colorscheme could highlight colon lines as something else than a comment by changing the highlight for the shColon highlight group.

AFAICT from reading :help ft-bash-syntax there is no setting to change those default highlights. However the fact that the sh syntax script makes no provision for quoted strings extending on more than one line can be regarded as a bug (or as a limitation). I'm CC-ing Charles "Dr. Chip" Campbell, the current maintainer of that script.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
203. You're an active member of more than 20 newsgroups.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to