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 151 remaining solutions by signing in and submitting your own entry
#152 Deepak Surti / dmsurti - Score: 36 - 03/19/15 @ 20:28
/1<CR>a[2]<Esc>o{<Esc>%lr,jc/{<CR><Esc>%lxo};<Esc>kV11k>ZZ

0 comments


#153 Peter Strawson / PeterStrawson - Score: 37 - 04/08/14 @ 23:59
/[<CR>i[2]<Esc>o{<Esc>vG>/;<CR>r,nx{2dddt{Go};<Esc><<ZZ

0 comments


#154 Tj / yrddy - Score: 37 - 08/13/14 @ 07:04
/[<CR>i[2]<Esc>o{<Esc>vG>/;<CR>r,nx{2dddt{Go};<Esc><<ZZ

0 comments


#155 AC / quadface - Score: 37 - 08/21/14 @ 17:07
jf[i[2]<Esc>o{<Esc>8Gls,<Esc>jvjjf{hxGi}<CR><Esc>kv3G>ZZ

0 comments


#156 Justin Knag / justinknag - Score: 37 - 08/30/14 @ 20:32
jf1a[2]<Esc>o{<Esc>5jlr,jV2jC{<Esc>4jo}<Esc><C-V>11kI<Tab><Esc>ZZ

0 comments


#157 Adrian Bradd / keepab - Score: 37 - 09/01/14 @ 13:45
/1<CR>a[2]<Esc>f{i{<CR><Esc>%lr,jVjjc{<Esc>%i}<CR><Esc>kV3G>ZZ

0 comments


#158 xRyanxBrutalityx / xHainingx - Score: 38 - 05/10/14 @ 00:31
j=Gf[i[2]<Esc>o<Tab>{<Esc>j/;<CR>r,>>jc2j<Tab>{<Esc>GO<Tab>}<Esc>:wq<CR>

0 comments


#159 iamevn / iamevn - Score: 38 - 07/08/14 @ 16:25
jjVGk>O{<Esc>/[<CR>Vkkc<Tab>{<Esc>klr,GO<Tab>}<Esc>ni[2]<Esc>:wq<CR>

0 comments


#160 Cristian Lupașcu / clupasq - Score: 38 - 02/22/16 @ 16:03
/[<CR>i[2]<Esc>o{<Esc>%lr,<Esc>jc2j{<Esc>%i}<CR><Esc>k<C-V>11kI<C-V><Tab><Esc>ZZ

0 comments


#161 Charlie / megacattt - Score: 39 - 04/13/14 @ 02:57
/[<CR>i[2]<C-O>o{<C-O>VG><Esc>/;<CR>r,jd/{<CR>i<Tab><Esc>13Go}<Esc>jhxZZ

0 comments


#162 Heron Medeiros / heronmedeiros - Score: 39 - 04/13/14 @ 04:04
/[<CR>i[2]<Esc>o{<Esc>/;<CR>r,o{<Esc>jVjjdGO}<Esc>V}{jj><Esc>:wq<CR>

0 comments


#163 Jones / Libidijones - Score: 39 - 04/17/14 @ 05:25
/[<CR>i[2]<Esc>o{<Esc>/;<CR>r,o{<Esc>jVjjdGO}<Esc>v}{jj><Esc>:wq<CR>

0 comments


#164 Jeffrey Beaupre / jeffreybeaupre - Score: 39 - 07/15/14 @ 01:51
/[<CR>i[2]<Esc>A<CR>{<Esc>/;<CR>r,j2ddd6f Ga<CR>}<Esc>kV?{<CR>n>ZZ

0 comments


#165 tork poter / torkpoter1 - Score: 40 - 04/28/14 @ 17:21
/p<CR>ea[2]<Esc>o{<Esc>>aB/;<CR>a<BS>,<CR>{<Esc>j2dddd>iBGO<Tab>}<Esc>ZZ

0 comments


#166 Chris Davison / davisonnn - Score: 40 - 05/24/14 @ 23:43
/[<CR>i[2]<Esc>o{<Esc>/;<CR>r,<CR>3ddi{<CR>;<BS><Esc>3GvG>Gi}<CR><Esc><<ZZ

0 comments


#167 Gurukandhamoorthi / Gurukandhamoor1 - Score: 40 - 07/13/17 @ 10:25
/1<CR>a[2]<Esc>o{<Esc>6>>/;r,<BS><BS><CR>r,jd2jO{<Esc>5>>GO<Tab>}<Esc>ZZ

0 comments


#168 Yasuhiro Asaka / grauwoelfchen - Score: 42 - 04/02/14 @ 16:59
/[<CR>i[2]<C-O>o{<C-O>VG><Esc>/;<CR>r,jd/{<CR>i<Tab><Esc>13Go}<Esc>ji<BS><Esc>:wq<CR>

0 comments


#169 Armen Shimoon / ArmenShimoon - Score: 42 - 04/27/14 @ 08:09
/[<CR>i[2]<Esc>o{v<BS><Esc>v12j>:8<CR>lr,j3ddO{<Esc>:13<CR>o}<Esc>:wq<CR>

0 comments


#170 Quasar Jarosz / quasarj - Score: 42 - 05/04/14 @ 06:04
jf[i[2]<Esc>o{<Esc>/;<CR>r,o{<Esc>j2dddt{dd4jO}<Esc>V8kkkk>ZZ

0 comments


#171 David Hume / djh95 - Score: 42 - 07/07/14 @ 10:02
/[<CR>i[2]<Esc>o{<Esc>vG>>/;<CR>unr,nx<CR><CR>{2dddt{Go};<Esc><<ZZ

0 comments


#172 ಸುಬ್ರಹ್ಮಣ್ಯ ಜೋಶಿ / subbucoding - Score: 42 - 04/01/15 @ 22:04
/;<CR>v/=<CR>di,<CR><Esc>/pkt<CR>wi[2]<End><CR>{<Esc>Gi}<CR><Esc>k<C-V>ggjjI<Tab><Esc>ZZ

0 comments


#173 Rik Jurriaans / RikJurriaans - Score: 43 - 04/04/14 @ 08:26
jf[i[2]<Esc>f{i{<CR><Esc>5jld4di},<CR>}<BS>{<CR><Esc>/;<CR>i}<BS><CR>}<Esc>>i{ZZ

0 comments


#174 Glauco Pires / grpires - Score: 44 - 11/26/14 @ 14:00
:3,14 norm >><CR>/[<CR>i[2]<Esc>o<Tab>{<Esc>8Glr,j3C<Tab>{<Esc>GO<Tab>}<Esc>ZZ

0 comments


#175 Craig Hills / chills42 - Score: 44 - 03/05/16 @ 03:01
jf[i[2]<Esc>7Gwklvt{/{<CR><Left>di,<CR><Esc>2Go{<Esc>14Gi}<CR><Esc><Up>v3G>ZZ

0 comments


#176 yyken / yyken1210 - Score: 45 - 04/28/14 @ 13:31
jt[a[2]<Esc>o{<Esc>%lr,kjj2Vkjj$hhdi{<CR><Esc>Gi}<CR><Esc>kV12k<Down>>ZZ

0 comments


#177 Angelos Mouzakitis / Gr33kR - Score: 45 - 05/30/14 @ 22:12
/1<CR>a[2]<Esc>o{<Esc>vG>/;<CR>r,nx{3ddt{t{dt{i{<CR><Esc>Go};<Esc><<ZZ

0 comments


#178 Jonathan Jin / jjin082693 - Score: 46 - 07/14/14 @ 14:02
/[<CR>i[2]<Esc>9G2dd4ddkklr,pO{<Esc>13G]ii}<Esc>3GO{<Esc>12>>:wq<CR>

0 comments


#179 Chris Yuen / kizzx2 - Score: 47 - 03/29/14 @ 10:39
jf[i[2]<Esc>o{<Esc>}k$r,jdjdt{GO}<Esc>V3G=jvi}<}10Gvi{<:wq<CR>

0 comments


#180 Lorin Hochstein / lhochstein - Score: 50 - 04/14/14 @ 01:54
/[<CR>i[2]<Esc>o<Tab>{<Esc>:4,8><CR>lr,<Esc>:9,11d<CR>O<Tab>{<Esc>13ggo}<Esc>:10,14><CR>ZZ

0 comments


#181 Chris Sun / chris_sun - Score: 51 - 04/03/14 @ 21:36
/1a<BS><CR>a[2]<Esc>j0v$Gk$><Esc>kjO{<Esc>j/;<CR>r,jj0Di<Tab>{<Esc>kddjddGO<Tab>}<Esc>ZZ

0 comments


#182 stephencheng / stephencheng - Score: 51 - 05/05/14 @ 14:58
jf[i[2]<Esc>o{<Esc>%lr,jdjdt{%i}<CR><Esc>kv3gg=jVjjj<10ggVjjj<:wq<CR>

0 comments


#183 damiann / _d4mian - Score: 52 - 04/24/14 @ 17:29
}kVjjjc},<CR>{<Esc>%a<CR>}<Esc>{wwwjwwwwi[]<Left>2<Esc>f{i{<CR><C-V><Esc><BS><Esc><C-V>}kI<Tab><Esc>;:<Esc>ZZ

0 comments


#184 Sheriuki / sheriuki - Score: 53 - 03/29/14 @ 10:19
/1<CR>a[2]<Esc>jV3j>O{<Esc>4jo},<Esc>:13,16m.<CR>V3k>O{<Esc>4jo}<Esc>:16,19d<CR>ZZ

0 comments


#185 Julien Pepy / shin_komuta - Score: 54 - 06/13/14 @ 21:35
/[<CR>i[2]<Esc>o{<Esc>M<Right>r,<Down>v<Down><Down>t{xGO}<Esc>V%<Up>%=<Esc><Left><Left><Right><Down>V<Down><Down><Down><L<Up><Up>.uV<Up><Up><Up><:x<CR>

0 comments


#186 LSMTD / LSMTD - Score: 61 - 12/09/14 @ 03:30
jf[i[2]<Esc>7G4ddo},<CR>{<BS>{<Esc>3GVG>13Ga<CR><BS>}<Esc>3GO{<Esc>7Gf/hhr,jr uujddjp:wq<CR>

0 comments


#187 Chris Trotman / solarnz - Score: 68 - 10/06/14 @ 02:06
jf[i[2]<Esc>po{<Esc>8Glr,<Esc>jc2j{<Esc>GO}<Esc>Vkkkkkkkkkkk=<Esc>:<Esc><Esc>jVjjj<<Esc>jjjjjjVjjj<<Esc>:wq<CR>

0 comments


#188 Alexander Bandukwala / abanduk - Score: 69 - 05/28/14 @ 23:28
jf[i[2]<Esc>o<Tab>{/;<BS><BS><Esc>/;x<BS><CR>xa,<Esc>V4k>5j2dddt{i<Tab>jV<BS><BS><Esc>j4kj5jkkVjjj>jjj$a<CR>}<Esc>:wq<CR>

0 comments


#189 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

189 active golfers, 626 entries

Leaderboard (lowest score wins):
25
#1 - trx / trxdbg

10/27/2016 at 01:35PM

25
#2 - Saki Gw / Sakigw

12/14/2016 at 04:30AM

25
#3 - Rami Hovi / hacker_lawyer

05/27/2017 at 04:28AM

25
#4 - Turkey Man / lvturkeyman

11/21/2017 at 06:31AM

26
#5 - Urtica dioica / udioica

03/29/2014 at 05:04PM

26
#6 - John Braxler / braxler

04/01/2014 at 11:57AM

26
#7 - Nikita Kouevda / nkouevda

04/03/2014 at 09:45PM

26
#8 - Vlad-Ștefan Harbuz / vladh

04/05/2014 at 01:27AM

26
#9 - G / drdevil44

04/09/2014 at 03:55PM

26
#10 - Felipe Spychalski / fspychalski

04/09/2014 at 05:01PM

26
#11 - kiho choi / ArtStandAlone

04/18/2014 at 10:20AM

26
#12 - Jacob Robles / JacobRobles0

05/07/2014 at 03:53PM

26
#13 - zmo / guyzmo

05/07/2014 at 08:34PM

26
#14 - Nolen Royalty / NolenRoyalty

05/08/2014 at 07:44AM

26
#15 - Alex Tercete / alextercete

06/03/2014 at 04:39AM

26
#16 - Robert Bruce / therealrobru

06/10/2014 at 05:42PM

26
#17 - John Meisner / jmeisned

06/24/2014 at 07:00PM

26
#18 - YAMADA Yukimi / edp02

06/27/2014 at 01:18PM

26
#19 - alex scott / 4l3xsc0tt

06/30/2014 at 04:01PM

26
#20 - Lasse Dalegaard / ldalegaard

07/06/2014 at 11:41PM

26
#21 - Juan-Lucas Picard / davidmh

09/09/2014 at 04:34AM

26
#22 - Felix Stridsberg / FelixStridsberg

09/22/2014 at 05:52PM

26
#23 - Ivan Brennan / ivanbrennan

12/07/2014 at 01:02AM

26
#24 - kimber gonzalez / kimberlycreates

02/06/2015 at 09:00PM

26
#25 - Terence Hang / technic_tec

02/14/2015 at 03:02AM

26
#26 - Matthieu Crapet / mcr05

03/01/2015 at 10:34AM

26
#27 - Mutter Mumble / muttermumble

07/12/2015 at 10:16AM

26
#28 - Mike Adams / davis_cromwell

10/11/2015 at 01:38AM

26
#29 - Jon Krause / jkrause314

01/12/2016 at 07:38AM

26
#30 - Aleksey Zhidkov / AlexeyZhidkov

02/24/2016 at 11:41AM