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 199 remaining solutions by signing in and submitting your own entry
#200 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

200 active golfers, 692 entries

Leaderboard (lowest score wins):
33
#121 - Sntano Euhsk / @SEuhsk

06/15/2014 at 06:06AM

33
#122 - Chase Lambert / @chasediscs

06/15/2014 at 10:52PM

33
#123 - Tim Vim / @vim_tim

07/01/2014 at 08:47PM

33
#124 - Dominik Szerszeń / @DominikSze

07/22/2014 at 03:11PM

33
#125 - vgmct / @vgmct

04/25/2015 at 06:48PM

34
#126 - Par Narvi / @ParNarvi

03/31/2014 at 04:18PM

34
#127 - Rasmus P / @rasmup

04/05/2014 at 09:26PM

34
#128 - Gabutero / @wizmokeri

04/14/2014 at 02:38AM

34
#129 - wizardwerdna / @wizardwerdna

05/12/2014 at 05:44PM

34
#130 - Drew DeVault / @sircmpwn

05/19/2014 at 06:49PM

34
#131 - shhittbrick / @shhittbrick

06/01/2014 at 01:50AM

34
#132 - Alexey Fedorov / @waterlink000

07/09/2014 at 04:35PM

34
#133 - Etienne Tremel / @etiennetremel

02/20/2016 at 08:40PM

34
#134 - Dan Piponi / @sigfpe

10/04/2016 at 08:25PM

34
#135 - Mark Blakeney / @bulletmark

12/21/2017 at 06:01AM

34
#136 - RockerZZY / @rocker_zzy

06/20/2020 at 02:57AM

35
#137 - James / @Dronak

04/03/2014 at 02:55PM

35
#138 - Jim Vogel / @BIThoughts

04/15/2014 at 06:15PM

35
#139 - Dylan Farnsworth / @FarnsworthDylan

04/21/2014 at 11:46PM

35
#140 - David Shields / @salacio

04/22/2014 at 08:05PM

35
#141 - Olivier Gayot / @duskCoder

05/01/2014 at 04:58PM

35
#142 - Jeff Parent / @jeffparent

05/11/2014 at 02:46AM

35
#143 - Jake Eaton / @Jake__Eaton

06/01/2014 at 05:20AM

35
#144 - Martijn Theunissen / @Damnesia__

06/12/2014 at 11:51PM

35
#145 - compiled wrong / @compiledwrong

06/17/2014 at 04:20AM

35
#146 - Michi Loro / @michiloro

07/07/2014 at 11:23AM

35
#147 - Naoki Masuko / @nmasuko

07/12/2014 at 07:38AM

35
#148 - April Gentle / @chen327684096

08/22/2014 at 11:12AM

35
#149 - Malte R / @maltoe

11/07/2014 at 05:45PM

35
#150 - SilentFl / @Silent_Fl

01/26/2015 at 02:09PM