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

172 active golfers, 456 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

18
#4 - Turkey Man / @lvturkeyman

11/28/2017 at 06:20PM

18
#5 - DHM / @DHM29978992

05/27/2018 at 01:48AM

18
#6 - John Braxler / @braxler

08/14/2018 at 03:29PM

18
#7 - Lory / @Lory46845742

12/27/2019 at 12:55PM

18
#8 - Kha Nguyen / @__ngtrongkha

01/22/2021 at 06:10AM

18
#9 - blabla zincou / @BZincou

03/24/2022 at 09:02PM

18
#10 - Jean George / @JeanGeo20504212

05/23/2022 at 03:46PM

18
#11 - russellzhaomao / @russellzhaomao

05/31/2022 at 02:29AM

18
#12 - Alex / @AlexanderHeatl2

07/01/2022 at 05:40PM

18
#13 - Qing Liu / @poeminlash

07/30/2022 at 03:31AM

18
#14 - Janzen / @__Coos

09/23/2022 at 09:23AM

18
#15 - 刘宏亮 / @AkeyCoy

09/25/2022 at 02:35AM

18
#16 - xiaoao1024 / @xiaoao1024

01/03/2024 at 03:40AM

18
#17 - EtherFan / @ether_fan

02/25/2024 at 06:28AM

19
#18 - roudens / @roudens2

02/20/2021 at 04:12AM

19
#19 - treb / @treb03683130

03/13/2021 at 12:58PM

20
#20 - Thomas Hiron / @thomashiron

02/23/2023 at 02:06PM

21
#21 - Gurukandhamoorthi / @Gurukandhamoor1

08/13/2017 at 04:05PM

21
#22 - Mihai / @mihaicristiant

03/25/2019 at 03:33PM

21
#23 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 09:08PM

21
#24 - mindgitrwx / @mindgitrwx

03/14/2021 at 04:37PM

21
#25 - James / @Dronak

11/07/2022 at 06:50PM

21
#26 - steve / @steve35773420

03/04/2023 at 04:52PM

21
#27 - shahanavaz m / @shahanavazm

03/06/2024 at 04:36AM

22
#28 - Aurélien Delahaye / @alkove

01/02/2011 at 09:29PM

22
#29 - Benoît Ryder / @benoitryder

01/03/2011 at 10:48PM

22
#30 - Danny O'Sullivan / @db0s

01/05/2011 at 11:01AM