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):
23
#91 - floyd / @floyd10086

05/20/2020 at 08:10AM

24
#92 - Seve / @Seve_py

05/18/2020 at 06:35AM

26
#93 - Mitchell Horning / @HorningMitchell

07/03/2020 at 04:51PM

26
#94 - Tiago Nascimento / @tigum27

07/18/2020 at 05:03PM

26
#95 - quemeraisc / @quemeraisc

11/05/2020 at 04:10PM

26
#96 - nd183 / @nd1832

12/10/2020 at 02:28PM

26
#97 - grsh / @girish_i_am

05/28/2021 at 02:00PM

26
#98 - nickGPT / @nickandbro

08/24/2024 at 07:17AM

27
#99 - Jérémy Caldas / @jeremcs

05/22/2020 at 07:05PM

27
#100 - natasha / @CallMeNatchos

06/01/2020 at 12:05AM

27
#101 - Bob / @Bob37174065

06/01/2020 at 12:21PM

27
#102 - Bob Streams / @BobStreams1

06/01/2020 at 06:57PM

27
#103 - Jackie / @Jackie57887507

06/02/2020 at 04:15AM

27
#104 - Alex Lucchesi / @suarigata

06/12/2020 at 03:15PM

27
#105 - JLObject / @powful_panda

07/01/2020 at 07:17PM

27
#106 - Brennan Barker / @BrennanJBarker

07/04/2020 at 12:13PM

27
#107 - Gergely Risko / @errge

07/28/2020 at 10:18PM

27
#108 - Sam Houston / @shouston33

07/29/2020 at 11:14PM

27
#109 - Thiago Becker / @beckert

08/06/2020 at 04:37PM

27
#110 - Martin Bielik / @mabielik

08/06/2020 at 09:48PM

27
#111 - Luc Kien Hang / @luckienhang

09/04/2020 at 12:39AM

27
#112 - Piotr Kaznowski / @kaznowski

09/14/2020 at 07:58PM

27
#113 - grubeb / @grubeb4

09/25/2020 at 06:00PM

27
#114 - RaylanFox / @RaylanFox

10/02/2020 at 06:49AM

27
#115 - Vinícius Hoyer / @viniciushoyer

10/08/2020 at 02:34PM

27
#116 - AAbraxas / @AAbraxas1

10/08/2020 at 08:36PM

27
#117 - wilsonept / @wilsonept1

10/25/2020 at 01:12PM

27
#118 - pherapont / @pherapont1

12/28/2020 at 10:16AM

27
#119 - Björn Struckmeier / @BjrnStruckmeie1

01/02/2021 at 03:34PM

27
#120 - Jakob Weickmann / @jweickm

02/16/2022 at 09:39PM