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 5ec18a61827ca60009087755

Replace pattern with 1, 2, 3, ... on each line

For each line replace a search pattern (in this case $) with numbers starting at 1 and then increasing by 1 for each replaced match. a$b$c$ -> a0b1c2

Start file
I can't see the $ for all the $,
But there $ not $ $ tomorrow.
$ she can do $ and 4,
$ the $ in the $ and $ the $.
End file
I can't see the 1 for all the 2,
But there 1 not 2 3 tomorrow.
1 she can do 2 and 4,
1 the 2 in the 3 and 4 the 5.

View Diff

1,4c1,4
< I can't see the $ for all the $,
< But there $ not $ $ tomorrow.
< $ she can do $ and 4,
< $ the $ in the $ and $ the $.
\ No newline at end of file
---
> I can'
t see the 1 for all the 2,
> But there 1 not 2 3 tomorrow.
> 1 she can do 2 and 4,
> 1 the 2 in the 3 and 4 the 5.
\ No newline at end of file

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 231 remaining solutions by signing in and submitting your own entry
#232 shahanavaz m / @shahanavazm - Score: 134 - 03/28/24 @ 23:54
:let c=0|exe "function! C() \n let c+=1 \n return<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>g:<Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right> g:c \n endfunction"<CR>:g/\$/s//\=C)H<C-H><C-H>()/g|let g<BS>c=0<CR>ZZ

0 comments


Created by: @kaddkaka

232 active golfers, 1150 entries

Leaderboard (lowest score wins):
21
#31 - Ray Dennis / @raysden

01/07/2021 at 11:21PM

21
#32 - Nicolas Pagny / @NicolasPagny

01/09/2021 at 12:03AM

21
#33 - A A A / @37fatos

01/09/2021 at 02:25AM

21
#34 - Andreas Siegrist / @andreaszwei

01/21/2021 at 09:02PM

21
#35 - 蔡徐坤真是爱吃屎 / @Hashub7

01/22/2021 at 04:08AM

21
#36 - pikjes / @pikjes2

07/14/2021 at 03:57PM

21
#37 - Bspammer / @Bspammer

08/15/2021 at 05:09PM

21
#38 - Roman Privalov / @RomanPrivalov

09/10/2021 at 06:00PM

21
#39 - yancy / @yancy_dong

09/17/2021 at 06:32AM

21
#40 - ややお / @yayaoh

01/03/2022 at 09:53AM

21
#41 - dorianm / @dorianm

05/08/2022 at 01:18AM

21
#42 - russellzhaomao / @russellzhaomao

05/23/2022 at 01:28PM

21
#43 - Janzen / @__Coos

09/14/2022 at 12:31PM

21
#44 - d44d3w / @d44d3w

02/26/2023 at 09:13PM

21
#45 - Aly Thobani / @alythobani

05/29/2024 at 09:53PM

21
#46 - Peppa Pig / @PeppaPigSg

07/15/2024 at 09:31AM

22
#47 - Toby Hawkins / @Toby_Hawkins

05/17/2020 at 11:54PM

22
#48 - Jon Krause / @jkrause314

05/18/2020 at 02:56AM

22
#49 - Quentin Leroy / @qnleroy

05/18/2020 at 04:12PM

22
#50 - Kevin Keefe / @KevinKeefe5

05/18/2020 at 04:30PM

22
#51 - "Smylers" / @Smylers2

05/18/2020 at 07:20PM

22
#52 - Jake Van Alstyne / @jake_va

05/18/2020 at 10:07PM

22
#53 - Ebi / @ehan6

05/19/2020 at 05:50AM

22
#54 - haipeng li / @HaipengLie

05/21/2020 at 06:05AM

22
#55 - garry quested / @GQuested

05/21/2020 at 10:31AM

22
#56 - 于吉星 / @fishermryn

05/22/2020 at 03:18AM

22
#57 - Jewi / @j3wi

05/22/2020 at 11:30PM

22
#58 - Sheng Xi / @shenghsi

05/23/2020 at 06:55AM

22
#59 - Commence Corporation / @CommenceCorp

05/23/2020 at 12:49PM

22
#60 - Kai.Li / @KaiLi19

05/24/2020 at 11:29AM