Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comments inside parentheses mess up the syntax coloring of shell script #487

Open
LLyaudet opened this issue Nov 19, 2015 · 4 comments

Comments

@LLyaudet
Copy link

commented Nov 19, 2015

Hi,

I've found the following bug with syntax coloring of shell scripts in vi and vim.
(I just tested it on Ubuntu with
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32)
Rustines incluses : 1-52
)
If you add comments outside parenthesis, it works fine.
But if you add comments inside parenthesis, or worse comments with quotes, the syntax coloring is totally messed up.

I join a sample shell script to demonstrate the bug.
(I had to rename the file from .sh to .txt because GitHub can't upload .sh...)

Best regards,
Laurent Lyaudet

PS : I reported this bug a year ago on launchpad but it wasn't the right place:
https://bugs.launchpad.net/ubuntu/+source/vim/+bug/1380110
I'll update the status of the bug there once it is solved.

testBugVim .txt

@chrisbra

This comment has been minimized.

Copy link
Member

commented Nov 19, 2015

Please discuss this with the maintainer of the current indentation file. See [Contributing.md](Please discuss this with the maintainer of the current indentation file. See Contributing.md)

@chrisbra

This comment has been minimized.

Copy link
Member

commented Nov 19, 2015

@LLyaudet

This comment has been minimized.

Copy link
Author

commented Nov 20, 2015

Hi,
Thanks for the quick answer.
I tested the latest syntax/sh.vim (version 142) as you suggested.
I attach the result for a slightly modified shell script:
bugsyntaxcoloringvimsh_142
As you can see there is a problem with the syntax coloring, all three "touch" commands should have same syntax coloring.

Anyway, this is way better than what occurred before when I tested with version 131
bugsyntaxcoloringvimsh_131
of sh.vim:

Best regards,
Laurent Lyaudet

@LLyaudet

This comment has been minimized.

Copy link
Author

commented Nov 24, 2015

Hi,
Thanks for the answer.
I don't know what may be the cause of the differences between what you get and what I get.
I will wait that some newer version of Vim makes it to Debian or Ubuntu to see if it changes.
I know that the third touch is not in a subshell but I don't think it's clearer with a different color for commands in a subshell. Actually it was the same yellow color for all commands whatever the subshell nesting level with version 131, as long as you removed the comments that messed up the syntax coloring. I will not argue about taste and colors, so it's fine for me if you prefer to have different color for it, as long as nesting levels beyond 0 and 1 are handled...
However, I don't know if you have different highlightings for the parameters of the first two touch inside the parentheses. If it's not the case then I'll wait for a newer version, as I said. Otherwise, having the name of the file highlighted in the same yellow that is used for commands is a bug.

Best regards,
Laurent Lyaudet

@k-takata k-takata added the runtime label Oct 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.