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):
35
#61 - Ruby Sapphire / @RubySapphire20

12/15/2018 at 06:40AM

35
#62 - Mateen Ulhaq / @sicariusnoctis

02/13/2019 at 05:03AM

35
#63 - ahm4711 / @ahm4711

03/02/2019 at 09:57PM

35
#64 - albalitz / @_albalitz

06/12/2019 at 10:23AM

35
#65 - Melvin Cheung / @MelvinCheung

11/10/2019 at 03:32PM

35
#66 - Jason Neylon / @jasonneylon

03/24/2020 at 06:45PM

35
#67 - Kha Nguyen / @__ngtrongkha

03/14/2021 at 07:59AM

35
#68 - Иван / @wansmer

04/25/2023 at 09:59PM

36
#69 - tPenguinLTG / @tpenguinltg

09/23/2018 at 05:11PM

36
#70 - Rasmus Bergström / @JRasmusBm

09/25/2018 at 04:06PM

36
#71 - Dave Brda / @BrdaDave

10/25/2018 at 09:16PM

36
#72 - name / @name65894813

11/15/2018 at 03:52PM

36
#73 - Jonathan Gin / @jonathangin52

12/05/2018 at 10:13PM

36
#74 - Maas Lalani / @maaslalani

12/05/2018 at 10:15PM

36
#75 - Bennett / @bennettbackward

12/19/2018 at 11:52AM

36
#76 - churaki / @churaki

01/29/2019 at 11:36AM

36
#77 - amal / @cdsudama

02/03/2019 at 10:05PM

36
#78 - Wei Wen / @goweiwen

02/14/2019 at 07:49PM

36
#79 - Sherab Giovannini / @shaddycls

05/04/2019 at 09:36AM

36
#80 - Jason / @roosjason

06/15/2020 at 08:15AM

37
#81 - Marius Jurgelenas / @MarenasLT

09/21/2018 at 11:31AM

37
#82 - daniel / @daniel31464605

09/26/2018 at 07:46AM

37
#83 - Tom Smeding / @TomSmeding

11/05/2018 at 10:36PM

37
#84 - 永森 / @nagk05

11/18/2018 at 10:01AM

37
#85 - Rand Omperson / @197258444

04/17/2019 at 10:12PM

37
#86 - majo senf / @majo_senf

06/17/2019 at 08:57PM

37
#87 - Delon / @delonleonard

01/09/2020 at 11:55PM

37
#88 - John Doe / @JohnDoe75830353

06/04/2021 at 12:18AM

37
#89 - James / @Dronak

11/18/2022 at 09:38PM

38
#90 - Edouard Piette / @EdPiette

10/09/2018 at 09:33AM