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):
31
#91 - Marcin Cabaj / @marcincabaj

04/03/2014 at 08:07PM

31
#92 - usrbin / @notusrbin

04/09/2014 at 05:04PM

31
#93 - Jeff Runningen / @jeffrunningen

04/10/2014 at 08:14PM

31
#94 - Milind Ganjoo / @mganjoo

04/23/2014 at 08:40PM

31
#95 - 土ヤ / @ttsuchiya

04/25/2014 at 08:29AM

31
#96 - skensell / @skensell

04/27/2014 at 12:09AM

31
#97 - Marcin Mucha / @marcinmucha

04/28/2014 at 03:50PM

31
#98 - Dane Summers / @dsummersl

05/30/2014 at 01:28PM

31
#99 - Tom Cammann / @tea_sea

08/06/2014 at 01:22PM

31
#100 - Mauro Persano / @fzort

06/05/2015 at 07:30PM

31
#101 - TweetDreams / @TweetMusicians

10/16/2016 at 07:19AM

32
#102 - Nabi Studios / @Toribash

03/29/2014 at 01:59PM

32
#103 - Richard Ramsden / @rramsden

03/31/2014 at 01:52AM

32
#104 - Aidan Brumsickle / @aidanbrumsickle

04/02/2014 at 12:59PM

32
#105 - Jared Meyering / @Jmeyering

04/11/2014 at 02:54PM

32
#106 - Chris Trombley / @ctrombley

04/23/2014 at 10:38PM

32
#107 - Markus Kasper / @KasperBox

05/16/2014 at 08:39PM

32
#108 - TapTemplate / @TapTemplate

06/25/2014 at 12:25PM

32
#109 - Caek / @Caek_

06/27/2014 at 03:26AM

32
#110 - Ram Tamtam / @ramtamtamtam

07/07/2014 at 08:44PM

32
#111 - Ryan / @murftown

07/27/2014 at 03:24PM

32
#112 - Noah Ruderman / @noahc66260

10/04/2014 at 04:48AM

32
#113 - Carlos A Henríquez Q / @lagunex

01/18/2015 at 09:17PM

32
#114 - Oliver Christ / @0liverChrist

02/08/2015 at 08:48PM

32
#115 - Walker Boh / @walker_boh

10/09/2015 at 10:35AM

32
#116 - И К / @igorjan94

09/15/2016 at 08:37AM

32
#117 - Michał Dytko / @DytkoM

12/27/2016 at 01:29PM

33
#118 - RobertT / @techrt2050

04/01/2014 at 05:29PM

33
#119 - はちよん / @84____

04/22/2014 at 01:09PM

33
#120 - Solar Powered Robot / @moskrin

05/01/2014 at 06:41PM