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):
24
#61 - Adam Pohorecki / @apohorecki

01/03/2011 at 12:34PM

24
#62 - Kyle Willmon / @kylewillmon

01/03/2011 at 05:01PM

24
#63 - Pete Johns / @johnsyweb

01/12/2011 at 11:35AM

24
#64 - Eivind Jahren / @HaskellElephant

01/17/2011 at 05:44PM

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

01/30/2011 at 07:23AM

24
#66 - Joost / @vlabakje

02/12/2011 at 06:20PM

24
#67 - vg / @vimgolfer

02/27/2011 at 09:24PM

24
#68 - Pavlo Klets / @p01nt

03/19/2011 at 09:10AM

24
#69 - Terje Larsen / @terlars

04/07/2011 at 09:56PM

24
#70 - Junfeng / @junfeng

07/22/2011 at 02:36PM

24
#71 - nicolas bo / @thevegeta

11/09/2011 at 03:29PM

24
#72 - Pei-Lun Lee / @ypcatw

01/09/2012 at 06:02AM

24
#73 - Kerson Hsiao / @KersonHsiao

07/18/2012 at 01:52AM

24
#74 - Marco Hinz / @_mhinz_

05/21/2013 at 11:27PM

24
#75 - Woojung Kim 김우중 / @_kimwz

07/17/2013 at 10:17AM

24
#76 - Domingue Justin / @_jdomingue

01/08/2014 at 04:57PM

24
#77 - Ram Tamtam / @ramtamtamtam

07/02/2014 at 01:49PM

24
#78 - Walker Boh / @walker_boh

12/14/2015 at 09:18AM

24
#79 - Matti Sairanen / @MattiSairanen

08/03/2017 at 12:22PM

24
#80 - Brando / @brandonce

02/04/2025 at 07:17AM

25
#81 - Josh Weinberg / @jcweinberg

12/31/2010 at 06:23PM

25
#82 - Behnam Esfahbod / @zwnj

12/31/2010 at 06:53PM

25
#83 - Asmund / @herrasbe

01/07/2011 at 10:22PM

25
#84 - Rob Ciaccio / @RobertoCalavera

01/21/2011 at 07:07PM

25
#85 - Michał Taszycki / @mehowte

01/24/2011 at 02:12PM

25
#86 - Trevor Powell / @DoomedBunnies

12/01/2011 at 05:53AM

25
#87 - じょんあば / @john_ababa

03/13/2012 at 08:21AM

25
#88 - Tyler / @tylerbindon

04/07/2013 at 05:23AM

25
#89 - Joonas Pihlajamaa / @jokkebk

02/21/2014 at 10:14AM

25
#90 - Niels Madan / @nielsmadan

04/10/2015 at 01:47PM