Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 153285 - vim (7.0.17) syntax highlihting fault for loop enders (e.g. fi, done) in shell scripts
Summary: vim (7.0.17) syntax highlihting fault for loop enders (e.g. fi, done) in shel...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-29 05:28 UTC by Ville Aakko
Modified: 2007-05-11 03:22 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ville Aakko 2006-10-29 05:28:49 UTC
Vim (7.0.17) does not check correctly if loop ender-like words are actually loop enders. Such words (e.g. 'fi', 'done') are always interpreted as loop enders if the word is not preceded and succeeded by something alphanumeric.

An example:

#!/bin/bash
while true ; do
   echo done!
done

In the above the 'done' after 'echo', followed by an exclamation mark, is highlighted as the end of the while loop, while the correct 'done' is highlighted as a duplicate 'done'.

Another example:

#!/bin/bash
if [ "$1"x -eq "-MyServer"x ] ; then
   ssh santa@korvatunturi.fi
fi

In the example above, the 'fi' following the dot is highlighted as the ender of the fi -loop, and again the correct 'fi' will be highlighted as if it were wrong.

However, these are highlighted correctly:

#!/bin/bash
if true; then
  echo suomifi
fi


#!/bin/bash

while true; do
  echo doneIsAll
done


Reproducible: Always

Steps to reproduce:
1. Try the examples above.
2. Look at the wrong color highlighting
3. cry (a little)

Actual results:
In both examples something before the actual loop ender is detected us such. 

Expected results:
Vim should detect the loop ender correctly.
Comment 1 Mike Kelly (RETIRED) gentoo-dev 2007-05-11 03:22:21 UTC
Well, one easy way around this is to quote the offending line, like so:

#!/bin/bash
if [ "$1"x -eq "-MyServer"x ] ; then
   ssh "santa@korvatunturi.fi"
fi

Of course, that isn't a real fix. However, this is really a bug in the syntax/sh.vim script provided by upstream, so I'm going to close this bug as UPSTREAM.

If you could report this bug to the upstream vim maintainers, I'm sure they'll come up with a good fix. Here's their instructions for submitting a bug report (taken from their FAQ):

2.6. Where can I report bugs?

First collect the required information using the following command:

    :source $VIMRUNTIME/bugreport.vim

Now send the resulting text from the above command to the bugs@vim.org
e-mail address.

The Vim Development mailing list (see above) is a good place to discuss
general bugs.  If the bug you find is with syntax highlighting or some
other "added feature" (i.e. not directly programmed into vim), attempt to
inform the maintainer of that feature.

For more information, read

    :help bug-reports

When a patch is made to fix this, I'll make a new gentoo release of vim.