# New sharness/test vim syntax

4 messages from 2020-11-26 to 2020-12-09. Participants: Felipe Contreras, Jeff King, Emily Shaffer.
Thread: https://gitlist.dev/t/54720

## Felipe Contreras, 2020-11-26 10:24

Subject: New sharness/test vim syntax
Message-ID: <CAMP44s1D-Zp3KDS+Hi74a=Lkc7Nc_0qiEzQEF0Pmj=bD8i+=JQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s1D-Zp3KDS%2BHi74a%3DLkc7Nc_0qiEzQEF0Pmj%3DbD8i%2B%3DJQ%40mail.gmail.com

```
Hello,

It gets a bit tedious to see all the tests in the same color, so I
wrote my own vim syntax file so that at least the body of
test_expect_success is highlighted properly.

I've updated it to make it handle more cases, and the result doesn't
look bad at all:

https://i.imgur.com/qDgvjtu.png

You can find it on my dotfiles:

https://github.com/felipec/dotfiles/blob/master/.vim/syntax/sharness.vim

What I do is place it on ~/.vim/syntax/sharness.vim, and then add the
following to my ~/.vimrc:

  au! BufRead,BufNewFile */git/t/*.sh set ft=sharness

I hope you find this useful.

Cheers.

-- 
Felipe Contreras

```

## Jeff King, 2020-12-08 17:56

Subject: Re: New sharness/test vim syntax
Message-ID: <X8++TTnv95IAIkZL@coredump.intra.peff.net>
URL: https://gitlist.dev/e/X8%2B%2BTTnv95IAIkZL%40coredump.intra.peff.net
In-Reply-To: <CAMP44s1D-Zp3KDS+Hi74a=Lkc7Nc_0qiEzQEF0Pmj=bD8i+=JQ@mail.gmail.com>

```
On Thu, Nov 26, 2020 at 04:24:42AM -0600, Felipe Contreras wrote:

> It gets a bit tedious to see all the tests in the same color, so I
> wrote my own vim syntax file so that at least the body of
> test_expect_success is highlighted properly.

Thanks for sharing this. Over the years I've gotten used to the horrible
all-red view when editing our test scripts, but I'm looking forward to
leaving that behind. :)

-Peff

```

## Emily Shaffer, 2020-12-08 21:54

Subject: Re: New sharness/test vim syntax
Message-ID: <20201208215411.GB3783238@google.com>
URL: https://gitlist.dev/e/20201208215411.GB3783238%40google.com
In-Reply-To: <X8++TTnv95IAIkZL@coredump.intra.peff.net>

```
On Tue, Dec 08, 2020 at 12:56:29PM -0500, Jeff King wrote:
> 
> On Thu, Nov 26, 2020 at 04:24:42AM -0600, Felipe Contreras wrote:
> 
> > It gets a bit tedious to see all the tests in the same color, so I
> > wrote my own vim syntax file so that at least the body of
> > test_expect_success is highlighted properly.
> 
> Thanks for sharing this. Over the years I've gotten used to the horrible
> all-red view when editing our test scripts, but I'm looking forward to
> leaving that behind. :)

Thanks for bumping this mail, Peff - I saw it come in, said "oh heck
yeah, I'll install that later" ... and then forgot :)

But I've installed it now. This is awesome. Thanks for sharing it
Felipe!

 - Emily

```

## Felipe Contreras, 2020-12-09 00:30

Subject: Re: New sharness/test vim syntax
Message-ID: <CAMP44s3qUNdGHV2sCovj1Ls7MGesB8_uuX39h4zhCZ_aG-jCsQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMP44s3qUNdGHV2sCovj1Ls7MGesB8_uuX39h4zhCZ_aG-jCsQ%40mail.gmail.com
In-Reply-To: <20201208215411.GB3783238@google.com>

```
On Tue, Dec 8, 2020 at 3:54 PM Emily Shaffer <emilyshaffer@google.com> wrote:
>
> On Tue, Dec 08, 2020 at 12:56:29PM -0500, Jeff King wrote:
> >
> > On Thu, Nov 26, 2020 at 04:24:42AM -0600, Felipe Contreras wrote:
> >
> > > It gets a bit tedious to see all the tests in the same color, so I
> > > wrote my own vim syntax file so that at least the body of
> > > test_expect_success is highlighted properly.
> >
> > Thanks for sharing this. Over the years I've gotten used to the horrible
> > all-red view when editing our test scripts, but I'm looking forward to
> > leaving that behind. :)
>
> Thanks for bumping this mail, Peff - I saw it come in, said "oh heck
> yeah, I'll install that later" ... and then forgot :)
>
> But I've installed it now. This is awesome. Thanks for sharing it
> Felipe!

You're welcome!

I also sent a patch to add a project-wide .vimrc file, to minimize the
burden on each individual developer.

A little bit of quality of life never hurts.

Cheers.

-- 
Felipe Contreras

```
