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 177 remaining solutions by signing in and submitting your own entry
#178 Zigmas Bitinas / @samgiz - Score: 111 - 02/11/24 @ 20:46
:g/^/m 0<CR><Esc><Esc><Esc>qqq:for i in range(1,6)|execute i .'<BS> 's/!<BS>^/'. o<BS>i /<BS>,<BS>. \<BS>'. ' | endfore<CR>:<Up><BS><CR>i<Del>6<Up><Up><Up><Up><Up><BS><Del><Del><Esc>:qw<BS><BS>wq<CR>

0 comments


Created by: @jamesconroyfinn

178 active golfers, 480 entries

Leaderboard (lowest score wins):
33
#151 - akira_simpson / @akira_simpson

01/31/2012 at 06:18PM

33
#152 - Dan Huang / @yuzeh

02/16/2012 at 12:10AM

33
#153 - Melvin Cheung / @MelvinCheung

05/24/2017 at 03:50PM

34
#154 - Tom Duijf / @tomduijf

02/12/2011 at 06:02PM

34
#155 - Raul Brito / @raulbrito

06/16/2011 at 09:30AM

35
#156 -  Ikhsan Maulana / @ixandidu

12/31/2010 at 04:46PM

35
#157 - yamasita taisuke / @yaasita

07/12/2014 at 05:07AM

36
#158 - Joe Hassick / @jhassick

12/31/2010 at 06:22PM

36
#159 - Nicolas Friedli / @NicolasFriedli

10/28/2012 at 07:11PM

36
#160 - でよ / @tada_kun8

01/31/2023 at 02:23PM

37
#161 - woodspock / @woodspock

12/31/2010 at 06:48PM

38
#162 - брови ломиком / @dimstunt

01/27/2023 at 07:34PM

38
#163 - nickGPT / @nickandbro

08/28/2024 at 11:32PM

38
#164 - Akshay Aurora / @akshayaurora

10/11/2024 at 05:49PM

39
#165 - Joel Taylor / @joelteon_

12/31/2010 at 11:42PM

39
#166 - Antoine Hérault / @Herzult

01/03/2011 at 10:14PM

40
#167 - solsTiCe d'Hiver / @solstice_dhiver

01/01/2011 at 09:11PM

43
#168 - Toto l'haricot / @nico_le_terribl

01/09/2011 at 06:58PM

45
#169 - David E Smith / @david3smith

12/31/2010 at 07:28PM

46
#170 - Joshua Flanagan / @jflanagan

01/01/2011 at 12:01AM

50
#171 - libicocco / @libicocco

12/31/2010 at 07:08PM

51
#172 - Daniel Niemczyk / @Adentalis

12/07/2023 at 06:28PM

55
#173 - Jan B. / @bracki

01/03/2011 at 04:52PM

57
#174 - Oliver Christ / @0liverChrist

10/16/2013 at 09:36PM

60
#175 - Hamey / @unknownHamX

01/26/2023 at 05:33PM

70
#176 - @grhkm@infosec.exchange / @grhkm21

12/18/2022 at 06:36PM

78
#177 - neleai / @enlaei

12/31/2010 at 09:49PM

111
#178 - Zigmas Bitinas / @samgiz

02/11/2024 at 08:46PM