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

82 active golfers, 241 entries

Leaderboard (lowest score wins):
24
#31 - Jean George / @JeanGeo20504212

06/09/2022 at 07:41PM

24
#32 - jaggujajamensan / @jaggujajamensan

02/12/2024 at 03:53PM

26
#33 - Kai Yuan / @kentyuan

10/09/2013 at 10:49AM

26
#34 - Tyler / @tylerbindon

10/13/2013 at 06:13AM

26
#35 - buz / @buzbone

10/15/2013 at 08:57AM

26
#36 - gary.klindt@googlema / @garstekli

11/12/2013 at 06:59PM

26
#37 - Kerson Hsiao / @KersonHsiao

08/31/2014 at 11:19AM

26
#38 - Matt / @mcr05

01/10/2015 at 07:08PM

26
#39 - Walker Boh / @walker_boh

12/07/2015 at 12:26PM

26
#40 - Olivier Bégassat / @zk_evm

06/15/2023 at 12:57PM

27
#41 - Adam McLain / @adammclain

10/09/2013 at 04:54PM

28
#42 - codegourmet / @codegourmet

10/09/2013 at 10:37AM

28
#43 - Marcin Szamotulski / @me_coot

10/09/2013 at 04:01PM

28
#44 - evilmoe ☮ / @evilmoe

10/13/2013 at 06:14PM

28
#45 - cj / @cj01101

10/18/2013 at 10:15PM

29
#46 - Stefan Schmidt / @stafue

12/06/2013 at 10:06AM

29
#47 - Gurukandhamoorthi / @Gurukandhamoor1

08/20/2017 at 03:11PM

30
#48 - RockerZZY / @rocker_zzy

06/15/2020 at 12:36AM

31
#49 - Édouard M'tou / @DouardM

10/09/2013 at 06:37PM

31
#50 - aRkadeFR / @aRkadeFR

10/10/2013 at 06:36AM

31
#51 - Ian Oxley / @ianoxley

10/10/2013 at 12:10PM

31
#52 - James / @Dronak

10/10/2013 at 02:02PM

32
#53 - Jacob Buete / @JBuete

07/04/2017 at 06:56AM

43
#54 - Steve Tjoa / @stevetjoa

10/11/2013 at 06:24PM

43
#55 - Devin V. / @enrual

12/15/2013 at 06:01AM

43
#56 - Robert Argeanton / @argeanton

01/06/2014 at 08:45AM

43
#57 - Quota / @Quotad

01/20/2014 at 01:37PM

44
#58 - Oliver Christ / @0liverChrist

10/23/2013 at 09:47PM

44
#59 - Dmitry Petrov / @can3p

02/25/2014 at 10:41AM

44
#60 - Patrick Pitoscia / @Patrick03960431

08/20/2014 at 03:13AM