2

I'm having some issue with the default "Dr. Chip" sh.vim highlighter. Specifically, it's failing to recognise the comment character # after a touch command. e.g.

touch foo # it's here

It doesn't see the #, and hence the ' is parsed, marking all lines after this a "quoted string".

Syntax failing

In @akshay's case, highlighting works as expected. I'm using the following:

  • Arch Linux
  • Vim 7.4 (2013 Aug 10, compiled Apr 29 2016 11:28:12); Included patches: 1-1797
  • sh.vim version 147, but I also tried version 151

I've also tested without plugins or vimrc activated (vim -u NONE /tmp/test.sh), but this also fails.

In this case, :scriptnames produces the following:

  1: /usr/share/vim/vim74/syntax/syntax.vim
  2: /usr/share/vim/vim74/syntax/synload.vim
  3: /usr/share/vim/vim74/syntax/syncolor.vim
  4: /usr/share/vim/vim74/filetype.vim
  5: /usr/share/vim/vimfiles/ftdetect/csv.vim
  6: /usr/share/vim/vimfiles/ftdetect/r.vim
  7: /usr/share/vim/vim74/syntax/sh.vim

And :set filetype? shows filetype=sh.

  • Are you sure? It seems to be working fine for me, with your example using the default sh.vim syntax highlighter. What is your Vim version? – akshay May 31 '16 at 1:52
  • @akshay Yes I'm sure, but TBH I was a it surprised that it would fail on a relatively common usage case. Here is a screenshot. I'm using Vim 7.4 (2013 Aug 10, compiled Apr 29 2016 11:28:12); Included patches: 1-1797 on Arch Linux. I'm using sh.vim version 147, but I tried the very latest and still have this problem. – Sparhawk May 31 '16 at 2:04
  • Hmm, it seems to work fine for me, although I am using version 151: Here's a screenshot from my end. – akshay May 31 '16 at 2:09
  • @akshay Yes, version 151 was the one I tested too (and also failed). Good to know that it can work though. I wonder why that could be. Preferably I'd just like to get the default working, so I'll edit the question. Thanks for the help so far! – Sparhawk May 31 '16 at 2:12
  • 4
    Use the vim_use mailing list to contact the maintainer of that script. He is usually pretty reactive. – romainl May 31 '16 at 5:30
1

I contacted Charles E Campbell (aka Dr Chip), the maintainer of default sh.vim highlighter. He responded very quickly with a new version 152 that fixes this problem for me. I'm still not sure why this problem only affected me and not @akshay though.

fixes syntax

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.