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 29 remaining solutions by signing in and submitting your own entry
#30 ミツバ@東京 / @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

30 active golfers, 85 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 - Daniel Steinberg / @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

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

04/28/2020 at 03:39PM

17
#17 - John Sumner / @rjsumner

04/28/2020 at 04:01PM

17
#18 - garry quested / @GQuested

04/29/2020 at 01:40PM

17
#19 - Robin Abrahamsson / @rqAbrahamsson

05/02/2020 at 11:01AM

17
#20 - Anthony BERNARD / @TweetTontony

05/03/2020 at 04:37PM

17
#21 - Mats Faugli / @matsfaugli

05/04/2020 at 11:57AM

17
#22 - floyd / @floyd10086

05/20/2020 at 08:22AM

18
#23 - Seve / @__Seve__

04/30/2020 at 10:41AM

20
#24 - Christophe Robillard / @krichtof

05/23/2020 at 10:43AM

20
#25 - pady. / @hundertzwoelf_

06/01/2020 at 02:56PM

21
#26 - Jeff Cui / @jeffacce

05/13/2020 at 01:40AM

23
#27 - Pan / @bekindtopeople2

05/12/2020 at 04:42PM

28
#28 - Axel / @Axel07930943

05/05/2020 at 05:21AM

30
#29 - yyang / @yyang25803679

05/06/2020 at 08:39AM

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

05/01/2020 at 01:58AM