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):
31
#151 - Alek Mugnozzo / @mugnozzo

05/30/2020 at 07:16AM

31
#152 - mohamed / @melsayed891

06/11/2020 at 11:27PM

31
#153 - Saurav Ray / @sauravpray

08/01/2020 at 07:22PM

31
#154 - ne0-1 / @ne0_01

08/28/2020 at 01:20PM

31
#155 - abhijeet patil / @abhijeetptl5

09/02/2020 at 06:54PM

31
#156 - mevmev / @mevmev8

09/26/2020 at 09:46PM

31
#157 - Zack Freedman / @freedman_zack

11/08/2020 at 07:31PM

31
#158 - steve / @steve35773420

11/20/2022 at 01:46PM

31
#159 - UrbanNinja1010 / @UrbanNinja1010

04/04/2025 at 03:50PM

32
#160 - Martin Kauppinen / @MartinKauppinen

08/15/2020 at 08:09PM

32
#161 - Leander Hendrikx / @leanderhendrikx

11/22/2020 at 01:05PM

32
#162 - projectDx / @Noritor

12/25/2021 at 09:00AM

33
#163 - Daniel Habib / @danielhvs

07/21/2020 at 09:54PM

33
#164 - SRINIVASU SALADI / @SRINIVASUS22587

02/10/2025 at 04:49AM

34
#165 - Demian Martinez / @demianuco

11/02/2020 at 12:29AM

34
#166 - Kapildev Neupane / @KapildevNeupane

01/01/2021 at 02:46PM

34
#167 - Sebastian Steenssøe / @VildMedPap

02/23/2024 at 06:42PM

35
#168 - Roger Stoltz / @rogsto1

05/17/2020 at 09:06PM

35
#169 - dl1991 / @dl19913

05/29/2020 at 05:26AM

35
#170 - Robert Verst / @r_verst

09/02/2020 at 11:18AM

35
#171 - Alice / @Alice10204425

09/30/2020 at 06:15AM

35
#172 - John Doe / @JohnDoe75830353

12/22/2020 at 02:20PM

35
#173 - :wq / @write_quit_22

05/20/2021 at 11:07AM

35
#174 - Alex / @AlexanderHeatl2

07/11/2022 at 11:47PM

36
#175 - MrRubiksSC / @RubiksSc

11/27/2020 at 04:01AM

37
#176 - Rishabh Dwivedi / @Rishabh45312910

07/03/2020 at 09:37PM

37
#177 - Norman Liu / @normanwliu

07/25/2020 at 11:04PM

37
#178 - GenericHardwareGamer / @GnrikHrdwrGamer

08/05/2020 at 10:48AM

38
#179 - vimgolfer98746521 / @vimgolfer987461

09/12/2020 at 04:35PM

38
#180 - OtterPy / @OtterPy

01/27/2021 at 03:36PM