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):
43
#211 - Kieran / @Kieran39992130

06/02/2020 at 05:09AM

43
#212 - jackmark / @jackmar14540583

07/10/2020 at 10:56AM

43
#213 - zapakh / @zapakh

01/22/2021 at 12:06AM

44
#214 - Srinath / @SrinathNair_

05/24/2020 at 06:09PM

50
#215 - fff / @fff51460170

01/13/2021 at 03:35AM

51
#216 - Richard Lowe / @b0ggyb33

06/30/2020 at 08:17AM

54
#217 - Yondonjamts Ganzorig / @yondonjamts_g

11/15/2020 at 01:10PM

54
#218 - Doemae / @Doemae02

05/25/2021 at 03:23PM

54
#219 - Arif Ardiansyah / @ArsanOfficial

02/22/2022 at 12:08AM

54
#220 - 咸糖🎯 / @GIA917229015

12/30/2023 at 03:44AM

55
#221 - gino / @imGinoW

05/21/2020 at 03:41PM

55
#222 - Yinghan Tan / @YinghanTan

05/30/2020 at 01:17AM

58
#223 - Graeme Smith / @InstaGraeme

01/20/2022 at 06:21AM

59
#224 - 梅 / @umetosawara

04/17/2022 at 09:39AM

61
#225 - dzungtran / @dzungtran89

09/19/2020 at 02:07AM

65
#226 - mr_l0n3lly / @mr_l0n3lly

07/01/2021 at 01:19PM

71
#227 - Bro / @SpeorgNot

08/21/2020 at 06:04PM

74
#228 - David / @imdavidhwang

11/10/2020 at 07:12PM

75
#229 - Pettsonator / @Pettsonator

05/25/2020 at 08:21PM

93
#230 - Kerry Wang / @kerrywang369

07/21/2023 at 09:20PM

94
#231 - ashfinal / @ashfinal

01/14/2025 at 07:35PM

134
#232 - shahanavaz m / @shahanavazm

03/28/2024 at 11:54PM