threads / discuss / 54720

New sharness/test vim syntax

Subject: New sharness/test vim syntax

## tl;dr

4 messages between Nov 26, 2020 and Dec 9, 2020.

replies: 3people: 3as markdown or json

Felipe Contreras· Nov 26, 2020, 10:24 UTC · lore
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· Dec 8, 2020, 17:56 UTC · re: Felipe Contreras · lore

Re: New sharness/test vim syntax

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· Dec 8, 2020, 21:54 UTC · re: Jeff King · lore

Re: New sharness/test vim syntax

On Tue, Dec 08, 2020 at 12:56:29PM -0500, Jeff King wrote:
Show 10 quoted lines
> 
> 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· Dec 9, 2020, 00:30 UTC · re: Emily Shaffer · lore

Re: New sharness/test vim syntax

On Tue, Dec 8, 2020 at 3:54 PM Emily Shaffer <emilyshaffer@google.com> wrote:
Show 18 quoted lines
>
> 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

← back to recent threads