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):
27
#121 - wemgulf / @wemgulfer

11/02/2023 at 10:46AM

28
#122 - Romeo Valentin / @Seecez

05/18/2020 at 06:40PM

28
#123 - Wayne / @lilwayne15561

05/22/2020 at 02:44AM

28
#124 - Aidan Wilson / @aidanbwilson

05/28/2020 at 02:12PM

28
#125 - betmaster / @betmstr

05/30/2020 at 11:14AM

28
#126 - serici / @serici

07/02/2020 at 04:49PM

28
#127 - Ivo Blöchliger / @aigledesalpes

07/06/2020 at 07:50PM

28
#128 - mindgitrwx / @mindgitrwx

08/06/2020 at 02:25PM

28
#129 - Ravi S Sinha / @ambidextrousTx

08/25/2020 at 12:56AM

28
#130 - Václav Pernička / @VaclavPernicka

09/05/2020 at 09:29PM

28
#131 - William / @williamwjh

04/11/2022 at 04:27PM

28
#132 - Luke Korn / @LukeKorn

05/13/2023 at 01:48PM

28
#133 - Mateus de Campos Cavalcanti / @mateusdcc

12/18/2023 at 01:01AM

28
#134 - zeptoterem / @zeta-omega-chi

06/13/2024 at 12:58PM

29
#135 - Ali Aslan / @AliAsla95742367

05/22/2020 at 05:33AM

29
#136 - Tzero Ocne / @TzeroOcne

05/26/2020 at 05:12PM

29
#137 - Mateo / @Mateo_BCN

05/29/2020 at 03:06PM

29
#138 - yuval jacoby / @yuval_jacoby

07/20/2020 at 08:39PM

29
#139 - drGsus / @drGsus

07/24/2020 at 06:06PM

29
#140 - Connor / @ronnocthered

08/15/2021 at 03:59AM

29
#141 - AMG / @anmigneer

12/14/2021 at 02:46PM

30
#142 - Andy / @ayy_ess_

05/23/2020 at 10:37PM

30
#143 - LCY / @Chooneh

06/07/2020 at 04:35AM

30
#144 - Muffin / @Muffin91707986

09/05/2020 at 09:22AM

30
#145 - Chris Conte / @chriscconte

10/02/2020 at 05:16PM

30
#146 - Dmitry Antonyuk / @dm_antonyuk

10/16/2020 at 03:28PM

30
#147 - 영훈 / @odjfnrtm

01/02/2021 at 07:23AM

30
#148 - ._. / @Katharsic

04/25/2022 at 03:37PM

31
#149 - 𝓂𝒿𝓇 ∋ ℝ / @real_mjr

05/21/2020 at 09:37AM

31
#150 - Jonathan Striblet / @Telbirts

05/24/2020 at 12:12AM