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 53369b712a09c1000223fb57

Two become one

We have two c arrays and want to make one two dimensional out of it. Can we do that?

Start file
/* Frame (32 bytes) */
static const unsigned char pkt1[32] = {
0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
0x05, 0xdc, 0x1b, 0xe3, 0x40, 0x00, 0x31, 0x06, /* ....@.1. */
0xe8, 0xc8, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8  /* ........ */
};

/* Frame (32 bytes) */
static const unsigned char pkt2[32] = {
0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
0x05, 0xdc, 0x6b, 0x98, 0x40, 0x00, 0x31, 0x06, /* ..k.@.1. */
0x99, 0x13, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8, /* ........ */
};
End file
/* Frame (32 bytes) */
static const unsigned char pkt1[2][32] = {
	{
	0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
	0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
	0x05, 0xdc, 0x1b, 0xe3, 0x40, 0x00, 0x31, 0x06, /* ....@.1. */
	0xe8, 0xc8, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8  /* ........ */
	},
	{
	0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
	0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
	0x05, 0xdc, 0x6b, 0x98, 0x40, 0x00, 0x31, 0x06, /* ..k.@.1. */
	0x99, 0x13, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8, /* ........ */
	}
};

View Diff

2,14c2,14
< static const unsigned char pkt1[32] = {
< 0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
< 0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
< 0x05, 0xdc, 0x1b, 0xe3, 0x40, 0x00, 0x31, 0x06, /* ....@.1. */
< 0xe8, 0xc8, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8  /* ........ */
< };
< 
< /* Frame (32 bytes) */
< static const unsigned char pkt2[32] = {
< 0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
< 0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
< 0x05, 0xdc, 0x6b, 0x98, 0x40, 0x00, 0x31, 0x06, /* ..k.@.1. */
< 0x99, 0x13, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8, /* ........ */
---
> static const unsigned char pkt1[2][32] = {
> 	{
> 	0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
> 	0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
> 	0x05, 0xdc, 0x1b, 0xe3, 0x40, 0x00, 0x31, 0x06, /* ....@.1. */
> 	0xe8, 0xc8, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8  /* ........ */
> 	},
> 	{
> 	0x08, 0x60, 0x6e, 0xf1, 0x3c, 0xb9, 0x9c, 0xc7, /* .`n.<... */
> 	0xa6, 0x35, 0x08, 0x12, 0x08, 0x00, 0x45, 0x00, /* .5....E. */
> 	0x05, 0xdc, 0x6b, 0x98, 0x40, 0x00, 0x31, 0x06, /* ..k.@.1. */
> 	0x99, 0x13, 0xcb, 0xd9, 0x00, 0xda, 0xc0, 0xa8, /* ........ */
> 	}

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 198 remaining solutions by signing in and submitting your own entry
#199 Peter Lustig / @germecon - Score: 123 - 08/06/14 @ 17:46
<C-><Up><C-><Up><C-><Up><C-><Up><C-><Up><C-><Up><C-><Up><C-><Up>j\\f1ijku<Esc>ua[]2<BS>jk<BS><BS><Esc>ba2<Esc>jkoi<BS>{jj<BS><BS><Esc>jjjjjwklrqr,jdd.d5wxxxxxxx\\f}/}<CR>a<CR>}jk<BS><BS><Esc>kkkkkkkkkkkkVjjjjjjjjjjj><Esc>:wq<CR>

0 comments


Created by: @saschagrunert

199 active golfers, 691 entries

Leaderboard (lowest score wins):
35
#151 - Joel Gallant / @joelg236

09/08/2015 at 02:54PM

35
#152 - Chenut Ludovic / @7Brwa7

04/05/2016 at 03:22PM

35
#153 - Will / @obiwan__k3n00bi

09/01/2016 at 07:00AM

35
#154 - Daniel / @Daniel00288663

03/30/2017 at 01:50PM

35
#155 - José / @AngelGaldamez

09/12/2019 at 02:23AM

36
#156 - Bart / @oneofmanybarts

04/02/2014 at 12:11PM

36
#157 - Jon Raphaelson / @lygaret

04/16/2014 at 03:27PM

36
#158 - daveseibert / @daveseibert

05/09/2014 at 08:58PM

36
#159 - Bill Booth / @ohiopyle

08/26/2014 at 05:58AM

36
#160 - luffy / @raxcoi

12/24/2014 at 02:08PM

36
#161 - Deepak Surti / @dmsurti

03/19/2015 at 08:28PM

37
#162 - Peter Strawson / @PeterStrawson

04/08/2014 at 11:59PM

37
#163 - Tj / @yrddy

08/13/2014 at 07:04AM

37
#164 - AC / @quadface

08/21/2014 at 05:07PM

37
#165 - Justin Knag / @justinknag

08/30/2014 at 08:32PM

37
#166 - Adrian Bradd / @keepab

09/01/2014 at 01:45PM

38
#167 - xRyanxBrutalityx / @xHainingx

05/10/2014 at 12:31AM

38
#168 - iamevn / @iamevn

07/08/2014 at 04:25PM

38
#169 - Cristian Lupașcu / @clupasq

02/22/2016 at 04:03PM

39
#170 - Charlie / @megacattt

04/13/2014 at 02:57AM

39
#171 - Heron Medeiros / @heronmedeiros

04/13/2014 at 04:04AM

39
#172 - Jones / @Libidijones

04/17/2014 at 05:25AM

39
#173 - Jeffrey Beaupre / @jeffreybeaupre

07/15/2014 at 01:51AM

40
#174 - tork poter / @torkpoter1

04/28/2014 at 05:21PM

40
#175 - Chris Davison / @davisonnn

05/24/2014 at 11:43PM

40
#176 - Gurukandhamoorthi / @Gurukandhamoor1

07/13/2017 at 10:25AM

42
#177 - Yasuhiro Яша Asaka / @grauwoelfchen

04/02/2014 at 04:59PM

42
#178 - Armen Shimoon / @ArmenShimoon

04/27/2014 at 08:09AM

42
#179 - Quasar Jarosz / @quasarj

05/04/2014 at 06:04AM

42
#180 - David Hume / @djh95

07/07/2014 at 10:02AM