Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 5ea82da50a8bcc00091923e4

Reconstruct the actual output from my unit test tool report

When a test fails, my unit test tool reports differences between the actual output and the expected output as follow: - line in the expected output but missing in the actual output are prefixed with a dash - unexpected lines in the actual output are prefixed with a plus sign - comments added by the unit test tool are prefixed with a question mark - common lines are showed `as-is` (well, almost;) From that "diff" format, I would like to reconstruct the actual output.

Start file
  {'claims': [{'add': '',
-              'mainsnak': {'property': 'P31',
+              'mainsnak': {'datatype': 'wikibase-item',
+                           'datavalue': {'type': 'wikibase-entityid',
+                                         'value': {'entity-type': 'item',
+                                                   'id': 'Q5',
+                                                   'numeric-id': 5}},
+                           'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
+                           'property': 'P31',
-                           'snaktype': 'value',
+                           'snaktype': 'value'},
?                                              +

-                           'value': {'entity-type': 'item', 'id': 'Q5'}},
+              'qualifiers': {},
               
'rank': 'normal',
               
'type': 'statement'}],
   
'id': 'Q44',
   
'ns': 0}
End file
{'claims': [{'add': '',
             
'mainsnak': {'datatype': 'wikibase-item',
                         
'datavalue': {'type': 'wikibase-entityid',
                                       
'value': {'entity-type': 'item',
                                                 
'id': 'Q5',
                                                 
'numeric-id': 5}},
                         
'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
                         
'property': 'P31',
                         
'snaktype': 'value'},

             
'qualifiers': {},
             
'rank': 'normal',
             
'type': 'statement'}],
 
'id': 'Q44',
 
'ns': 0}

View Diff

1,12c1,9
<   {'claims': [{'add': '',
< -              'mainsnak': {'property': 'P31',
< +              'mainsnak': {'datatype': 'wikibase-item',
< +                           'datavalue': {'type': 'wikibase-entityid',
< +                                         'value': {'entity-type': 'item',
< +                                                   'id': 'Q5',
< +                                                   'numeric-id': 5}},
< +                           'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
< +                           'property': 'P31',
< -                           'snaktype': 'value',
< +                           'snaktype': 'value'},
< ?                                              +
---
> {'claims': [{'add': '',
>              'mainsnak': {'datatype': 'wikibase-item',
>                           'datavalue': {'type': 'wikibase-entityid',
>                                         'value': {'entity-type': 'item',
>                                                   'id': 'Q5',
>                                                   'numeric-id': 5}},
>                           'hash': 'ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9',
>                           'property': 'P31',
>                           'snaktype': 'value'},
14,19c11,15
< -                           'value': {'entity-type': 'item', 'id': 'Q5'}},
< +              'qualifiers': {},
<                'rank': 'normal',
<                'type': 'statement'}],
<    'id': 'Q44',
<    'ns': 0}
---
>              'qualifiers': {},
>              'rank': 'normal',
>              'type': 'statement'}],
>  'id': 'Q44',
>  'ns': 0}

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 51 remaining solutions by signing in and submitting your own entry
#52 ミツバ@東京 / @mitubaEX - Score: 56 - 05/01/20 @ 01:58
:%s/^-\(.*\)\n//g<CR>:%s/+/ /g<CR>kkddggh<C-V>hjjjjjjjjjjjjjjd:wq<CR>

0 comments


Created by: @Yes_I_Know_IT

52 active golfers, 152 entries

Leaderboard (lowest score wins):
17
#31 - Robin Abrahamsson / @rqAbrahamsson

05/02/2020 at 11:01AM

17
#32 - Anthony BERNARD / @TweetTontony

05/03/2020 at 04:37PM

17
#33 - Mats Faugli / @matsfaugli

05/04/2020 at 11:57AM

17
#34 - floyd / @floyd10086

05/20/2020 at 08:22AM

17
#35 - Sergio Semedi / @SergioSemedi

02/09/2022 at 04:32PM

17
#36 - Alex / @AlexanderHeatl2

08/29/2022 at 09:56PM

17
#37 - Luoyb / @Luoyb

10/27/2023 at 02:04AM

17
#38 - naka / @nak38223985244

12/04/2023 at 12:36PM

18
#39 - Seve / @Seve_py

04/30/2020 at 10:41AM

18
#40 - D. 👋 / @DCT_cpp

02/09/2022 at 02:31PM

19
#41 - Иван / @wansmer

04/21/2023 at 07:35AM

20
#42 - Christophe Robillard / @krichtof

05/23/2020 at 10:43AM

20
#43 - pady. 🇪🇺 @hundertzwoelf@sueden.social / @hundertzwoelf_

06/01/2020 at 02:56PM

20
#44 - Khoyobegenn / @Khoyobegenn

06/24/2020 at 09:14AM

20
#45 - 김범준 / @kmbmjn

02/17/2021 at 06:17AM

20
#46 - hamb / @hamb88140219

03/05/2021 at 06:20AM

21
#47 - Jeff Cui / @jeffacce

05/13/2020 at 01:40AM

21
#48 - James / @Dronak

11/30/2022 at 09:37PM

23
#49 - Pan / @bekindtopeople2

05/12/2020 at 04:42PM

28
#50 - Axel / @Axel07930943

05/05/2020 at 05:21AM

30
#51 - yyang / @yyang25803679

05/06/2020 at 08:39AM

56
#52 - ミツバ@東京 / @mitubaEX

05/01/2020 at 01:58AM