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):
38
#91 - Nir Givon / @nir_givon

11/11/2018 at 02:12PM

38
#92 - PJ Frazer / @pj_frazer

12/02/2018 at 02:19AM

38
#93 - theBecwar / @thebecwar

08/19/2019 at 07:12PM

38
#94 - Andrii Soldatenko / @a_soldatenko

10/14/2022 at 10:21AM

39
#95 - Gayan Munasinghe / @gayanm

09/23/2018 at 04:50PM

39
#96 - prince ducaca / @prince_du_caca

09/26/2018 at 09:46PM

39
#97 - Keldwik Chaldain / @Suskeyhose

10/03/2018 at 02:16AM

39
#98 - Dr Rev J. “I am not a bot!” Kirchartz, KSC, KHS / @JKirchartz

10/30/2018 at 07:15PM

39
#99 - unclewangshushu / @shuwushu

11/29/2018 at 05:11PM

39
#100 - Nicolas Daval / @ndaval

04/08/2019 at 06:22PM

39
#101 - Aioriya / @AioriyaDonk

05/25/2020 at 01:10AM

39
#102 - RockerZZY / @rocker_zzy

06/11/2020 at 09:27AM

39
#103 - Xzavie / @Xzavie3

02/25/2021 at 04:24AM

40
#104 - Dax / @daaawx

10/18/2018 at 04:58PM

40
#105 - Sören Schellhoff / @Jackokomm

11/21/2018 at 04:02PM

41
#106 - Jason Chen / @chezbgone

07/04/2019 at 07:47AM

41
#107 - g-guy / @guydunigo

01/25/2023 at 12:49PM

42
#108 - masterpi / @masterpi16

09/23/2018 at 03:17PM

42
#109 - John Oleksowicz / @JohnOlek

10/05/2018 at 06:37PM

42
#110 - Jan Wedekind / @wedesoft

10/13/2018 at 08:11PM

42
#111 - tuyen / @tuyen66827418

11/27/2018 at 03:56PM

42
#112 - Oscar Broman / @oscarbroman

04/09/2019 at 03:50PM

42
#113 - Wistan Chou / @wisty97

08/14/2019 at 05:20PM

42
#114 - Marcio M Pereira / @iviarcio

04/25/2021 at 02:12PM

42
#115 - Diwakar Singh Parmar / @parmardiwakar150

08/28/2024 at 12:59PM

43
#116 - Anoop Kumar / @anooplive

09/21/2018 at 01:09PM

43
#117 - Mauricio Ariza / @_hell_spawn

09/26/2018 at 01:20PM

44
#118 - Fabio Branquinho / @branquif

11/08/2018 at 03:01PM

44
#119 - zenwalker / @zenwalker93

03/09/2019 at 01:43PM

45
#120 - Luis Rodriguez / @luisthecoder

11/13/2018 at 01:08AM