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):
16
#1 - Roger Stoltz / @rogsto1

04/28/2020 at 02:54PM

16
#2 - John Braxler / @braxler

04/28/2020 at 06:10PM

16
#3 - Ebi / @ehan6

04/28/2020 at 06:17PM

16
#4 - Florian Martin / @Florian72650031

04/29/2020 at 12:15AM

16
#5 - Jon Krause / @jkrause314

04/29/2020 at 12:17AM

16
#6 - Smylers / @Smylers2

04/29/2020 at 04:49AM

16
#7 - Saki Gw / @Sakigw

04/29/2020 at 09:11AM

16
#8 - Arthur Goodman / @ArthurGoodman3

04/29/2020 at 02:51PM

16
#9 - Sherab Giovannini / @shaddycls

05/01/2020 at 12:04AM

16
#10 - Tinko Minko / @tandikula

05/01/2020 at 06:38PM

16
#11 - bladehaze / @bladehaze

05/02/2020 at 10:20PM

16
#12 - Dan / @dstein64

05/04/2020 at 08:41PM

16
#13 - Jonáš Šerých / @serycjon

05/18/2020 at 04:18PM

16
#14 - 于吉星 / @fishermryn

05/28/2020 at 08:48AM

16
#15 - RockerZZY / @rocker_zzy

05/30/2020 at 04:55AM

16
#16 - Valdimar / @genkobar

06/06/2020 at 04:59PM

16
#17 - mocihan / @mocihan

06/28/2020 at 03:35AM

16
#18 - A A A / @37fatos

02/02/2021 at 05:45PM

16
#19 - Jung Yeon Park / @park_jungy

02/06/2021 at 11:39PM

16
#20 - pikjes / @pikjes2

03/21/2021 at 08:10PM

16
#21 - roudens / @roudens2

05/08/2021 at 03:07PM

16
#22 - Arya Kumar / @SusSquirrel

05/27/2021 at 11:18PM

16
#23 - Roman Privalov / @RomanPrivalov

09/13/2021 at 04:05PM

16
#24 - russellzhaomao / @russellzhaomao

05/24/2022 at 01:04AM

16
#25 - Janzen / @__Coos

10/06/2022 at 03:09PM

16
#26 - vimmac / @vimmac13823

06/14/2023 at 09:45AM

16
#27 - Peppa Pig / @PeppaPi95550250

06/29/2024 at 09:30AM

17
#28 - Sylvain Leroux / Yes, I Know IT ! / @Yes_I_Know_IT

04/28/2020 at 03:39PM

17
#29 - John Sumner / @rjsumner

04/28/2020 at 04:01PM

17
#30 - garry quested / @GQuested

04/29/2020 at 01:40PM