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 4d1e037dde2f897c2a000417

Reverse and count

Someone typed things upside down and now a Vim ninja needs to reverse the lines and count how many there are.

Start file
Sixth line
Fifth line
Fourth line
Third line
Second line
First line
End file
1. First line
2. Second line
3. Third line
4. Fourth line
5. Fifth line
6. Sixth line

View Diff

1,6c1,6
< Sixth line
< Fifth line
< Fourth line
< Third line
< Second line
< First line
---
> 1. First line
> 2. Second line
> 3. Third line
> 4. Fourth line
> 5. Fifth line
> 6. Sixth line

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 113 remaining solutions by signing in and submitting your own entry
#114 aaaa3331 / aaaa3331 - Score: 33 - 01/03/11 @ 21:48
:%s!^!\=7-line(".").". "!|sort<CR>ZZ

0 comments

#115 David Duponchel / dduponchel - Score: 33 - 01/08/11 @ 19:07
<C-V>GI6. <Esc>jr5jr4jr3jr2jr1Vgg:sort<CR>ZZ

0 comments

#116 Stephan Weller / stephan_weller - Score: 33 - 01/10/11 @ 21:16
:g/./m0<CR>qqI<C-R>=line('.')<CR>. <Esc>jq5@qZZ

0 comments

#117 drio / drio - Score: 33 - 01/11/11 @ 13:32
<C-V>GI6. <Esc>jr5jr4jr3jr2jr1Vgg:sort<CR>ZZ

0 comments

#118 Andrey A. Ugolnik / andreyugolnik - Score: 33 - 01/19/11 @ 19:46
:%s!^!\=7-line(".").". "!|sort<CR>ZZ

andreyugolnik: Not mine solution. Even more i can't understund how this works.

1 comment

#119 William Dunand / wdunand - Score: 33 - 11/28/11 @ 08:34
:g/./m0<CR>:%s/^/\=line(".").". "<CR>ZZ

0 comments

#120 You-Siang Lin / yslinnctu - Score: 33 - 12/02/11 @ 11:39
<C-V>GI6. <Esc>jr5jr4jr3jr2jr1Vgg:sort<CR>ZZ

0 comments

#121 Al / 96258 - Score: 33 - 12/14/11 @ 16:31
:g/^/m0<NL>qqI<C-R>=line(".")<NL>. <Esc>jq5@qZZ

0 comments

#122 Xavier Nayrac / lkdjiin - Score: 33 - 12/30/11 @ 15:46
:g/./m0<CR>qaI<C-R>=line('.')<CR>. <Esc>jq5@aZZ

0 comments

#123 akira_simpson / akira_simpson - Score: 33 - 01/31/12 @ 18:18
<C-V>GI6. <Esc>jr5jr4jr3jr2jr1Vgg:sort<CR>ZZ

0 comments

#124 Dan Huang / yuzeh - Score: 33 - 02/16/12 @ 00:10
<C-V>GI6. <Esc>jr5jr4jr3jr2jr1Vgg:sort<CR>ZZ

0 comments

#125 Melvin Cheung / MelvinCheung - Score: 33 - 05/24/17 @ 15:50
:%s!^!\=7-line(".").". "!|sort<CR>ZZ

0 comments

#126 Tom Duijf / tomduijf - Score: 34 - 02/12/11 @ 18:02
<C-V>GI6. <Esc><Down>R5<Down><Left>4<Down><Left>3<Down><Left>2<Down><Left>1<Esc>Vgg:sort<CR>ZZ

0 comments

#127 Raul Brito / raulbrito - Score: 34 - 06/16/11 @ 09:30
<C-V>GI6. <Esc>jr5jr4jr3jr2jr1<C-V>gg<End>:sort<CR>ZZ

0 comments

#128  Ikhsan Maulana / ixandidu - Score: 35 - 12/31/10 @ 16:46
:g/^/m0<CR><C-V>GI. <Esc>:%s/^/\=line('.')<CR><C-Z>ZZ

0 comments

#129 yamasita taisuke / yaasita - Score: 35 - 07/12/14 @ 05:07
<C-V>GI1. <Esc>:5<CR>qajylk"_xP<C-A>kq4@a:%sort<CR>ZZ

0 comments

#130 Joe Hassick / jhassick - Score: 36 - 12/31/10 @ 18:22
:g/^/m0<CR>i1. <Esc>qav^yjP^<C-A>q4@a<C-V>kkkA. <Esc>ZZ

0 comments

#131 Nicolas Friedli / NicolasFriedli - Score: 36 - 10/28/12 @ 19:11
i6<Down><Left><Up><Esc>u<C-V>GI6. <Esc>jr5jr4jr3jr2jr1:sor<CR>ZZ

0 comments

#132 woodspock / woodspock - Score: 37 - 12/31/10 @ 18:48
ddGpggdd<k4>jPggdd<k3>jpuPggddjpkddkPZZ

0 comments

#133 Joel Taylor / joelteon_ - Score: 39 - 12/31/10 @ 23:42
:g/^/m0<CR>:^<BS>%s/^/l<BS>\=line"<BS>(".").". "<CR>ZZ

0 comments

#134 Antoine Hérault / Herzult - Score: 39 - 01/03/11 @ 22:14
<C-V>jjjjjjjjjI1. <Esc>r6jr5jr4jr3jr2:%sort<CR>:x<CR>

0 comments

#135 solsTiCe d'Hiver / solstice_dhiver - Score: 40 - 01/01/11 @ 21:11
:sort! /.*/<CR><C-V><Down><Down><Down><Down><Down>I1. <Esc><Down>r2jr3jr4jr5jr6ZZ

0 comments

#136 Toto l'haricot / nico_le_terribl - Score: 43 - 01/09/11 @ 18:58
I6. <Esc><Down>.<Down>.<Down>.<Up><Down><Down>.<Down>.05<C-X><Up>4<C-X><Up>3<C-X><Up>2.<Up>.r5:sor nu|x<CR>

0 comments

#137 David E Smith / david3smith - Score: 45 - 12/31/10 @ 19:28
:g/%/<BS><BS>^/m0<CR>:%s/^/\=line(.<BS>'.').'. '<CR>ZZ

0 comments

#138 Joshua Flanagan / jflanagan - Score: 46 - 01/01/11 @ 00:01
:g/^/m0<CR>i1. <Esc>j^i2. <Esc>j^.^<C-A>j.i4. <Esc>j^.^<C-A>j.i6. <Esc>ZZ

0 comments

#139 libicocco / libicocco - Score: 50 - 12/31/10 @ 19:08
:%s/^/1. <CR>Vkkdr4ggr6Pr3ddr2pjddggPjjjddr5pjdd4GPZZ

0 comments

#140 Jan B. / bracki - Score: 55 - 01/03/11 @ 16:52
:g/./m0<CR><C-V><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down>I1. <Esc>j<C-A>j<C-A><C-A>j<C-A><C-A><C-A>j<C-A><C-A><C-A><C-A>j<C-A><C-A><C-A><C-A><C-A><Esc>:x<CR>

0 comments

#141 Oliver Christ / 0liverChrist - Score: 57 - 10/16/13 @ 21:36
ddGpkddggPjddjjpkddkkPjddp:%s/^/\=line"(<BS><BS>(".").",<BS>. "<CR>ZZ

0 comments

#142 neleai / enlaei - Score: 78 - 12/31/10 @ 21:49
dd<Down><Down><Down><Down>p<Up>dd<Up><Up><Up><Up>pdd<Home><Up>p<Up>dd<Down><Down><Down>p<Up>dd<Up><Up><Up>p<Down>ddp<Up><Up><Up><Up>i1. <Down><Home>2. <Down><Home>3. <Down><Home>4. <Down><Home>5.,<BS> <Down><Home>6. <Esc>:wq<CR>

0 comments

Created by: jamesconroyfinn

142 active golfers, 374 entries

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

06/25/2015 at 07:17PM

18
#2 - Jon Krause / jkrause314

01/20/2016 at 10:29PM

18
#3 - Peter Brynza / v3_1

08/28/2016 at 08:07PM

21
#4 - Gurukandhamoorthi / Gurukandhamoor1

08/13/2017 at 04:05PM

22
#5 - Aurélien Delahaye / alkove

01/02/2011 at 09:29PM

22
#6 - Benoît Ryder / benoitryder

01/03/2011 at 10:48PM

22
#7 - Danny O'Sullivan / db0s

01/05/2011 at 11:01AM

22
#8 - Balkoth / _Balkoth_

01/08/2011 at 11:04PM

22
#9 - Tim Chase / gumnos

06/11/2011 at 12:27AM

22
#10 - not so punk :] / notsopunk

06/19/2011 at 05:21PM

22
#11 - Justin Love / wondible

07/19/2011 at 02:42PM

22
#12 - p0ckets / p0ckets

10/09/2011 at 07:58PM

22
#13 - Jaime A. Sánchez / jashbeta

12/22/2011 at 04:18AM

22
#14 - Vasil Sakarov / vsakarov

01/17/2012 at 06:40PM

22
#15 - Renat Aksitov / Korvin79

03/03/2012 at 06:25PM

22
#16 - Garry Shutler / gshutler

03/31/2012 at 06:11PM

22
#17 - Nolen Royalty / NolenRoyalty

04/22/2012 at 03:07AM

22
#18 - Conner McDaniel / connermcd

09/25/2012 at 12:04AM

22
#19 - Petro Тrouq / zulolosi

07/25/2013 at 03:21AM

22
#20 - John Braxler / braxler

05/18/2014 at 05:50PM

22
#21 - Evan Coleman / edc1591

06/01/2015 at 09:03PM

23
#22 - Thedward the Edward / thedward

12/31/2010 at 08:37PM

23
#23 - Wei Dai / clvv42

01/01/2011 at 01:18AM

24
#24 - Utkarsh Kukreti / utkarshkukreti

12/31/2010 at 05:06PM

24
#25 - Prody / Prody225

12/31/2010 at 05:22PM

24
#26 - Eike Schulte / eikeschulte

12/31/2010 at 05:32PM

24
#27 - Peter Anselmo / peter_anselmo

12/31/2010 at 07:28PM

24
#28 - Henri Bourcereau / mmai

12/31/2010 at 09:07PM

24
#29 - Alain Gilbert / alain_gilbert

12/31/2010 at 09:16PM

24
#30 - Ricardo Mendes / locks

12/31/2010 at 10:19PM

24
#31 - Israel Chauca F. / Raimondi

01/01/2011 at 07:57AM

24
#32 - Leeward Bound / leewardbound

01/02/2011 at 01:01AM

24
#33 - Brad / bjjwillis

01/02/2011 at 01:31AM

24
#34 - Adam Pohorecki / apohorecki

01/03/2011 at 12:34PM

24
#35 - Kyle Willmon / kylewillmon

01/03/2011 at 05:01PM

24
#36 - Pete Johns / johnsyweb

01/12/2011 at 11:35AM

24
#37 - Eivind Jahren / HaskellElephant

01/17/2011 at 05:44PM

24
#38 - h_east (トロッコ6個) / h_east

01/30/2011 at 07:23AM

24
#39 - Joost / vlabakje

02/12/2011 at 06:20PM

24
#40 - vg / vimgolfer

02/27/2011 at 09:24PM

24
#41 - Pavlo Klets / p01nt

03/19/2011 at 09:10AM

24
#42 - Terje Larsen / terlars

04/07/2011 at 09:56PM

24
#43 - Hu Junfeng / junfeng

07/22/2011 at 02:36PM

24
#44 - nicolas bo / thevegeta

11/09/2011 at 03:29PM

24
#45 - Pei-Lun Lee / ypcatw

01/09/2012 at 06:02AM

24
#46 - Kerson Hsiao / KersonHsiao

07/18/2012 at 01:52AM

24
#47 - Marco Hinz / _mhinz_

05/21/2013 at 11:27PM

24
#48 - Woojung Kim 김우중 / _kimwz

07/17/2013 at 10:17AM

24
#49 - Domingue Justin / _jdomingue

01/08/2014 at 04:57PM

24
#50 - Ram Tamtam / ramtamtamtam

07/02/2014 at 01:49PM

24
#51 - Walker Boh / walker_boh

12/14/2015 at 09:18AM

24
#52 - Matti Sairanen / MattiSairanen

08/03/2017 at 12:22PM

25
#53 - Josh Weinberg / jcweinberg

12/31/2010 at 06:23PM

25
#54 - Behnam Esfahbod / zwnj

12/31/2010 at 06:53PM

25
#55 - Asmund Liseth / Asmund_L

01/07/2011 at 10:22PM

25
#56 - Rob Ciaccio / RobertoCalavera

01/21/2011 at 07:07PM

25
#57 - Michał Taszycki / mehowte

01/24/2011 at 02:12PM

25
#58 - Trevor Powell / DoomedBunnies

12/01/2011 at 05:53AM

25
#59 - 無ん垢の叫び / john_ababa

03/13/2012 at 08:21AM

25
#60 - Tyler / tylerbindon

04/07/2013 at 05:23AM

25
#61 - Joonas Pihlajamaa / jokkebk

02/21/2014 at 10:14AM

25
#62 - Niels Madan / nielsmadan

04/10/2015 at 01:47PM

26
#63 - Matthew Draper / _matthewd

12/31/2010 at 04:56PM

26
#64 - Will Gray / graywh

12/31/2010 at 07:41PM

26
#65 - Clint Tseng / cxlt

12/31/2010 at 09:38PM

26
#66 - Ilya Ermolin / ermolinis

12/31/2010 at 10:17PM

26
#67 - Pierre / Pihour

01/01/2011 at 01:58AM

26
#68 - Nándor Komzák / rubymood

01/01/2011 at 02:16AM

26
#69 - Denis Odorcic / denisodorcic

01/02/2011 at 01:09AM

26
#70 - PA Parent / paparent

01/02/2011 at 01:52PM

26
#71 - Paul King / nrocy

01/02/2011 at 05:49PM

26
#72 - Mattiassich Ákos / mattiassicha

01/03/2011 at 02:34PM

26
#73 - Avinash Baliga / avinashbaliga

03/27/2011 at 07:58PM

26
#74 - Jesús Espino / jespinog

09/05/2011 at 08:19PM

26
#75 - ltn614 / ltn614

09/30/2015 at 12:36PM

26
#76 - Daniel / Daniel00288663

04/05/2017 at 02:33PM

27
#77 - Rod Cloutier / RodCloutier

12/31/2010 at 04:50PM

27
#78 - Guillaume Bonnoron / gbonnoron

12/31/2010 at 05:19PM

28
#79 - Douglas Stockwell / dstockwell

12/31/2010 at 06:45PM

28
#80 - Leonard Chin / lchin

01/02/2011 at 04:29PM

28
#81 - Marcin Sza / coot_

11/24/2012 at 11:20PM

28
#82 - Alex Hammel / AlexJHammel

12/24/2012 at 06:50PM

28
#83 - James / Dronak

09/22/2014 at 10:35PM

29
#84 - Antonio Lucca / tonyxzt

12/31/2010 at 06:42PM

29
#85 - Dmytro Shteflyuk / kpumuk

12/31/2010 at 09:52PM

29
#86 - Ben Lenarts / benlenarts

01/03/2011 at 12:09AM

29
#87 - PJ Probity / james_cartledge

01/03/2011 at 09:42AM

29
#88 - Kurt Gaastra / KGaastra

02/14/2012 at 06:03AM

29
#89 - Tyler Breisacher / tbreisacher

08/25/2012 at 09:09AM

29
#90 - w1zeman1p / wizemanip

11/06/2014 at 06:03AM

29
#91 - Raj / brshenoy

06/01/2015 at 05:07PM

30
#92 - Francisco Dibar / frandibar

01/07/2011 at 02:28AM

30
#93 - Sid Momin / mominsid

11/04/2015 at 09:58PM

30
#94 - Kyouma / kyoumaJohn

10/15/2016 at 09:51PM

31
#95 - Mohammad-Javad Izadi / mjizadi

01/05/2011 at 01:38PM

31
#96 - Frederik Mogensen / fmogensen

03/31/2011 at 10:17AM

32
#97 - Bill Odom / billodom

12/31/2010 at 11:04PM

32
#98 - Ujjwol Lamichhane / Ujjwol

01/01/2011 at 02:48AM

32
#99 - David / ddddddddavid

01/02/2011 at 03:47AM

32
#100 - Øystein Walle / oysteinwalle

07/10/2011 at 11:11AM

32
#101 - Dave / zzdave13

07/13/2011 at 09:40PM

32
#102 - jasper110 / jasper110

09/22/2011 at 09:13AM

32
#103 - Son of Bongo / bpcode

05/13/2012 at 11:46AM

32
#104 - Michael Limiero / michaellimiero

08/15/2012 at 04:47PM

32
#105 - Tom User / kiryph

05/30/2013 at 11:52AM

32
#106 - cj / cj01101

02/03/2014 at 11:31PM

33
#107 - kmymtksh / kmymtksh

12/31/2010 at 06:37PM

33
#108 - Ryan Horn / ryan_horn

12/31/2010 at 07:10PM

33
#109 - xer0x / xer0x

01/01/2011 at 08:41PM

33
#110 - Addisu Taddese / azeey

01/02/2011 at 02:50AM

33
#111 - Marc Lacoursière / RooSoft

01/02/2011 at 02:56AM

33
#112 - davidnorth / davidnorth

01/02/2011 at 03:07AM

33
#113 - Jens-Chr. Fischer / jcfischer

01/03/2011 at 10:40AM

33
#114 - aaaa3331 / aaaa3331

01/03/2011 at 09:48PM

33
#115 - David Duponchel / dduponchel

01/08/2011 at 07:07PM

33
#116 - Stephan Weller / stephan_weller

01/10/2011 at 09:16PM

33
#117 - drio / drio

01/11/2011 at 01:32PM

33
#118 - Andrey A. Ugolnik / andreyugolnik

01/19/2011 at 07:46PM

33
#119 - William Dunand / wdunand

11/28/2011 at 08:34AM

33
#120 - You-Siang Lin / yslinnctu

12/02/2011 at 11:39AM

33
#121 - Al / 96258

12/14/2011 at 04:31PM

33
#122 - Xavier Nayrac / lkdjiin

12/30/2011 at 03:46PM

33
#123 - akira_simpson / akira_simpson

01/31/2012 at 06:18PM

33
#124 - Dan Huang / yuzeh

02/16/2012 at 12:10AM

33
#125 - Melvin Cheung / MelvinCheung

05/24/2017 at 03:50PM

34
#126 - Tom Duijf / tomduijf

02/12/2011 at 06:02PM

34
#127 - Raul Brito / raulbrito

06/16/2011 at 09:30AM

35
#128 -  Ikhsan Maulana / ixandidu

12/31/2010 at 04:46PM

35
#129 - yamasita taisuke / yaasita

07/12/2014 at 05:07AM

36
#130 - Joe Hassick / jhassick

12/31/2010 at 06:22PM

36
#131 - Nicolas Friedli / NicolasFriedli

10/28/2012 at 07:11PM

37
#132 - woodspock / woodspock

12/31/2010 at 06:48PM

39
#133 - Joel Taylor / joelteon_

12/31/2010 at 11:42PM

39
#134 - Antoine Hérault / Herzult

01/03/2011 at 10:14PM

40
#135 - solsTiCe d'Hiver / solstice_dhiver

01/01/2011 at 09:11PM

43
#136 - Toto l'haricot / nico_le_terribl

01/09/2011 at 06:58PM

45
#137 - David E Smith / david3smith

12/31/2010 at 07:28PM

46
#138 - Joshua Flanagan / jflanagan

01/01/2011 at 12:01AM

50
#139 - libicocco / libicocco

12/31/2010 at 07:08PM

55
#140 - Jan B. / bracki

01/03/2011 at 04:52PM

57
#141 - Oliver Christ / 0liverChrist

10/16/2013 at 09:36PM

78
#142 - neleai / enlaei

12/31/2010 at 09:49PM