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 52552abfb089a00002000007

Create Leading Zeros

Create leading zeros only for id columns. Please use generic approach!

Start file
id	data	age	parent_id
11	"Test"	12	123
123	"Test2	11	null
155	"Test5	19	123
111	"Test"	12	1123
1123	"Test2	11	11
1155	"Test5	19	1123
211	"Test"	12	123
2123	"Test2	11	11
2155	"Test5	19	123
2111	"Test"	12	1123
3123	"Test2	11	11
3155	"Test5	19	1123
1	"root"	9	null
End file
id	data	age	parent_id
0011	"Test"	12	0123
0123	"Test2	11	null
0155	"Test5	19	0123
0111	"Test"	12	1123
1123	"Test2	11	0011
1155	"Test5	19	1123
0211	"Test"	12	0123
2123	"Test2	11	0011
2155	"Test5	19	0123
2111	"Test"	12	1123
3123	"Test2	11	0011
3155	"Test5	19	1123
0001	"root"	9	null

View Diff

2,6c2,6
< 11	"Test"	12	123
< 123	"Test2	11	null
< 155	"Test5	19	123
< 111	"Test"	12	1123
< 1123	"Test2	11	11
---
> 0011	"Test"	12	0123
> 0123	"Test2	11	null
> 0155	"Test5	19	0123
> 0111	"Test"	12	1123
> 1123	"Test2	11	0011
8,10c8,10
< 211	"Test"	12	123
< 2123	"Test2	11	11
< 2155	"Test5	19	123
---
> 0211	"Test"	12	0123
> 2123	"Test2	11	0011
> 2155	"Test5	19	0123
12c12
< 3123	"Test2	11	11
---
> 3123	"Test2	11	0011
14c14
< 1	"root"	9	null
---
> 0001	"root"	9	null

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 76 remaining solutions by signing in and submitting your own entry
#77 RobertT / @techrt2050 - Score: 127 - 10/10/13 @ 00:55
:v/null/s/\t\([0-9]\)$/\t000\1<CR>:<Up><Left><Left><BS><Left><Left><Left><Left><Left><Left><Left><Left>[0-9]<CR>:<Up><Left><Left><BS><Left><Left><Left><Left><Left><Left><Left>[0-9]<CR>:v/^id/s/^\(.\)\t/000\1\t<CR>:<Up><Left><Left><Left><Left><BS><Left><Left><Left><Left><Left><Left><Left>.<CR>:<Up><Left><Left><Left><Left><BS><Left><Left><Left><Left><Left><Left>.<CR>ZZ

0 comments


Created by: @robrob12

77 active golfers, 205 entries

Leaderboard (lowest score wins):
23
#1 - Urtica dioica / @udioica

10/09/2013 at 07:53PM

23
#2 - Petro Тrouq / @zulolosi

10/09/2013 at 11:50PM

23
#3 - Ingo / @ist3fani

10/12/2013 at 09:28AM

23
#4 - Conner McDaniel / @connermcd

10/30/2013 at 05:22AM

23
#5 - Yann Moisan / @YannMoisan

01/02/2014 at 12:55AM

23
#6 - John Braxler / @braxler

03/28/2014 at 09:31PM

23
#7 - Lifepillar / @lifepillar

06/27/2015 at 02:36PM

23
#8 - Turkey Man / @lvturkeyman

12/06/2017 at 04:53PM

24
#9 - Trevor Powell / @DoomedBunnies

10/09/2013 at 11:27AM

24
#10 - Tim Chase / @gumnos

10/09/2013 at 03:56PM

24
#11 - Jamie Schembri / @shkm

10/09/2013 at 06:31PM

24
#12 - Sergio Benitez / @Sergio965

10/09/2013 at 08:47PM

24
#13 - Sencer Selcuk / @sencers_

10/10/2013 at 03:25AM

24
#14 - StarkHalo / @hellektor

10/14/2013 at 12:47AM

24
#15 - Bradley M. Small / @BradleySmall

10/23/2013 at 06:44PM

24
#16 - Tzipan / @Tzipan

10/25/2013 at 11:59AM

24
#17 - James O Smith / @josmith4242

10/26/2013 at 07:31PM

24
#18 - thasso / @thasso23

10/27/2013 at 12:25PM

24
#19 - Nathan Wallace / @nathanmwallace

11/05/2013 at 07:54PM

24
#20 - Shawn Dumas / @shawndumas

11/06/2013 at 06:11AM

24
#21 - Jonathan Potter / @nTypeRed

11/11/2013 at 07:19PM

24
#22 - ynwsoft / @ynwsoft

12/20/2013 at 11:01AM

24
#23 - Joshua Appelman / @JoshuaAppelman

12/21/2013 at 08:59PM

24
#24 - Ali El Amine / @Allouch95

02/04/2014 at 09:58AM

24
#25 - Joonas Pihlajamaa / @jokkebk

02/21/2014 at 10:38PM

24
#26 - pftb12345 / @pftb12345

04/14/2015 at 01:08PM

24
#27 - DHM / @DHM29978992

05/29/2018 at 01:51AM

24
#28 - roudens / @roudens2

02/09/2021 at 01:15AM

24
#29 - Jean George / @JeanGeo20504212

06/09/2022 at 07:41PM

26
#30 - Kai Yuan / @kentyuan

10/09/2013 at 10:49AM