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 5ba4962fbbac05000bc2ddec

Preferably without multi-cursor plugin

Originally asked as question on reddit by kpthunder: https://www.reddit.com/r/vim/comments/9fvsro/what_is_the_most_efficient_way_to_go_about/

Start file
newState.set('foo', foo);
newState.set('bar', bar);
newState.set('banana', banana);
newState.set('bears', bears);
End file
state.foo = payload.foo;
state.bar = payload.bar;
state.banana = payload.banana;
state.bears = payload.bears;

View Diff

1,4c1,4
< newState.set('foo', foo);
< newState.set('bar', bar);
< newState.set('banana', banana);
< newState.set('bears', bears);
---
> state.foo = payload.foo;
> state.bar = payload.bar;
> state.banana = payload.banana;
> state.bears = payload.bears;

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 128 remaining solutions by signing in and submitting your own entry
#129 Jurica / @Jurica34581259 - Score: 63 - 11/15/18 @ 00:34
:%s/newstate.set('/state./g<CR>:%s/', / = payload./g<CR>:%s/)//g<CR>:wq<CR>

0 comments


Created by: @argshook

129 active golfers, 540 entries

Leaderboard (lowest score wins):
31
#31 - James Casey / @hanavi

12/22/2019 at 07:25PM

31
#32 - hepebexè / @hepebexe

01/25/2021 at 06:48PM

31
#33 - Fake Konto / @F4k3K0n70

02/14/2021 at 02:50PM

31
#34 - roudens / @roudens2

03/03/2021 at 03:58AM

31
#35 - treb / @treb03683130

03/12/2021 at 03:16PM

31
#36 - Francois Marais / @maraisf

05/17/2021 at 02:42PM

31
#37 - Alex / @AlexanderHeatl2

08/29/2022 at 08:20PM

31
#38 - z00master / @z00master

09/06/2022 at 05:13PM

31
#39 - moh ayaya / @AyayaMoh

09/17/2023 at 04:46PM

31
#40 - Luoyb / @Luoyb

11/03/2023 at 06:41AM

32
#41 - Steve / @fourbitbots

09/22/2018 at 03:30AM

32
#42 - golgi / @gloggyapparatus

10/02/2018 at 08:59AM

32
#43 - Benjamin Kiesl / @BenjaminKiesl

10/11/2018 at 02:37PM

32
#44 - Tuomas Jokioja / @TJokioja

10/12/2018 at 05:09PM

32
#45 - Sam Kim / @samkimhis

10/14/2018 at 04:50AM

32
#46 - Dima Matrohin / @wo_ogy

10/27/2018 at 10:39AM

32
#47 - abgalphabet / @abgalphabet

02/04/2019 at 09:31AM

33
#48 - Arijus / @argshook

09/21/2018 at 11:18AM

33
#49 - Not real / @Notreal70353016

09/21/2018 at 07:52PM

33
#50 - Ole Mussmann / @isbjornlabs

10/28/2018 at 01:32PM

33
#51 - pankaj singh / @pankajsingh013

01/15/2019 at 03:11PM

33
#52 - Arno / @arnoxmp

05/10/2019 at 11:03AM

33
#53 - countime / @countime1

03/17/2020 at 06:44AM

33
#54 - Ray Dennis / @raysden

01/12/2021 at 08:57PM

33
#55 - Tuure / @tuure_p

03/22/2021 at 01:35AM

34
#56 - Roger Bongers / @RogerBongers

10/02/2018 at 06:04PM

34
#57 - Maxim / @alfa101

01/09/2020 at 05:07AM

34
#58 - Jean George / @JeanGeo20504212

09/28/2021 at 02:36PM

34
#59 - 0xf00ff00f / @0xf00ff00f

10/19/2023 at 06:11PM

35
#60 - Per Forser / @perforcer

09/21/2018 at 04:18PM