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):
22
#61 - Andreas Buhr / @andreas_buhr

05/24/2020 at 01:23PM

22
#62 - Ryan Nevius / @ryannevius

05/24/2020 at 08:12PM

22
#63 - chocolate / @chocola81394123

05/26/2020 at 08:14PM

22
#64 - RockerZZY / @rocker_zzy

05/28/2020 at 07:44AM

22
#65 - sunny / @pooisonner

05/28/2020 at 08:21AM

22
#66 - Lili Boi / @lili_boi

05/31/2020 at 08:32PM

22
#67 - Patrick Weigert / @PatrickWeigert

06/01/2020 at 12:11AM

22
#68 - Gabriel Siqueira / @gabrielhsiq

06/06/2020 at 02:07AM

22
#69 - Georg Kaaserer / @climbim

06/07/2020 at 01:17PM

22
#70 - dirkrob / @dirkrob1

06/19/2020 at 01:21AM

22
#71 - Saurabh / @Saurabh09299

07/22/2020 at 02:09PM

22
#72 - Filipe Brandenburger / @filbranden

08/03/2020 at 04:49PM

22
#73 - Ivan Kwong / @IvanKwong5

08/09/2020 at 03:14PM

22
#74 - Łukasz Kadłubowski / @LAKadlubowski

08/21/2020 at 04:15AM

22
#75 - Андрей / @appomsk

08/21/2020 at 11:14AM

22
#76 - Brendan Schaenzer / @bschaenzer

09/30/2020 at 12:58AM

22
#77 - Leland Paul Kusmer / @lelandpaul

10/21/2020 at 12:12PM

22
#78 - Free Man / @FreeMan16396552

10/29/2020 at 03:17PM

22
#79 - vimspam / @vimspam

11/09/2020 at 05:27AM

22
#80 - hepebexè / @hepebexe

11/28/2020 at 01:48PM

22
#81 - roudens / @roudens2

12/06/2020 at 09:29AM

22
#82 - Dax / @zacoxi

12/11/2020 at 08:15AM

22
#83 - Jung Yeon Park / @park_jungy

01/01/2021 at 10:17PM

22
#84 - m397 / @m39752809546

06/01/2021 at 06:20AM

22
#85 - Georg Bökman / @BokmanGeorg

07/04/2021 at 09:21AM

22
#86 - Youssef Magdy / @youssef_magdy29

05/01/2022 at 12:57AM

22
#87 - moh ayaya / @AyayaMoh

08/28/2023 at 03:36PM

22
#88 - Luoyb / @Luoyb

10/27/2023 at 01:08AM

22
#89 - naka / @nak38223985244

11/29/2023 at 12:52PM

22
#90 - tk555 / @tk55513

05/04/2024 at 02:17PM