3

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.

Sparhawk
  • 580
  • 1
  • 3
  • 18
  • 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 01: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 02: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 02: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 02: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 05:30
  • Thanks @romainl. Good idea. (I just emailed him instead, so I don't have to subscribe to a mailing list.) – Sparhawk May 31 '16 at 06:30
  • Just to confirm, was the detected filetype sh? What's the output of scriptnames, after you open that file? – muru May 31 '16 at 07:08
  • @muru I've updated the question. – Sparhawk May 31 '16 at 08:27

1 Answers1

2

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

Sparhawk
  • 580
  • 1
  • 3
  • 18