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
#1 - Saki Gw / @Sakigw

05/18/2020 at 05:53AM

21
#2 - Jonáš Šerých / @serycjon

05/18/2020 at 11:06AM

21
#3 - せいほう / @FICSQF

05/18/2020 at 02:25PM

21
#4 - John Braxler / @braxler

05/20/2020 at 06:30PM

21
#5 - 王有铭 / @wangyouming1209

05/22/2020 at 09:58AM

21
#6 - Finlay McAfee / @finsqm

05/23/2020 at 04:54PM

21
#7 - Chris Young / @shric

05/27/2020 at 11:41AM

21
#8 - Miłosz Łakomy / @foobar01123

05/28/2020 at 03:33AM

21
#9 - Ryan McNamara / @MadDogMcNamara

05/28/2020 at 06:24PM

21
#10 - speisz / @speiszc

05/29/2020 at 10:03PM

21
#11 - Christophe Robillard / @krichtof

06/01/2020 at 02:47PM

21
#12 - Valdimar / @genkobar

06/02/2020 at 09:51PM

21
#13 - Jake / @Jake88567157

06/12/2020 at 01:33PM

21
#14 - TimMcGuire / @mcguire

06/13/2020 at 02:42AM

21
#15 - Robberechts Arne / @ArneRobberechts

06/13/2020 at 04:01PM

21
#16 - nihilistCookie / @NihilistCookie

06/14/2020 at 12:20PM

21
#17 - Hogo / @HogoBlog

06/14/2020 at 04:48PM

21
#18 - mocihan / @mocihan

06/27/2020 at 03:19PM

21
#19 - Jan Sturm / @JanSturm77

07/02/2020 at 07:39PM

21
#20 - PK / @pkeugine

07/10/2020 at 03:44PM

21
#21 - Виталий Макаров / @avada_keda_bra

07/14/2020 at 05:10PM

21
#22 - Jason / @jason_eveleth

07/23/2020 at 08:06AM

21
#23 - vito / @vito49999722

08/17/2020 at 07:11PM

21
#24 - Cao Van Bi / @CaoVanBi235

08/21/2020 at 01:59AM

21
#25 - akouryy / @akouryy1

09/05/2020 at 01:22PM

21
#26 - dezhonger / @dezhonger

09/05/2020 at 05:10PM

21
#27 - 刘宏亮 / @AkeyCoy

09/09/2020 at 05:40AM

21
#28 - mstronam / @mstronam

10/02/2020 at 04:06AM

21
#29 - lamtt77 / @lamtt77

10/08/2020 at 11:50PM

21
#30 - David Kutschke / @D4KU_

11/15/2020 at 01:47PM