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 113 remaining solutions by signing in and submitting your own entry
#114 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

114 active golfers, 459 entries

Leaderboard (lowest score wins):
40
#91 - Dax / @daaawx

10/18/2018 at 04:58PM

40
#92 - Sören Schellhoff / @Jackokomm

11/21/2018 at 04:02PM

41
#93 - Jason Chen / @chezbgone

07/04/2019 at 07:47AM

42
#94 - masterpi / @masterpi16

09/23/2018 at 03:17PM

42
#95 - John Oleksowicz / @JohnOlek

10/05/2018 at 06:37PM

42
#96 - Jan Wedekind / @wedesoft

10/13/2018 at 08:11PM

42
#97 - tuyen / @tuyen66827418

11/27/2018 at 03:56PM

42
#98 - Oscar Broman / @oscarbroman

04/09/2019 at 03:50PM

42
#99 - Wistan Chou / @wisty97

08/14/2019 at 05:20PM

42
#100 - Marcio M Pereira / @iviarcio

04/25/2021 at 02:12PM

43
#101 - Anoop Kumar / @anooplive

09/21/2018 at 01:09PM

43
#102 - Mauricio Ariza / @_hell_spawn

09/26/2018 at 01:20PM

44
#103 - Fabio Branquinho / @branquif

11/08/2018 at 03:01PM

44
#104 - zenwalker / @zenwalker93

03/09/2019 at 01:43PM

45
#105 - Luis Rodriguez / @luisthecoder

11/13/2018 at 01:08AM

45
#106 - GrimmT / @GrimmT10

12/23/2019 at 06:25PM

46
#107 - Paul Inc / @hiniol1982

10/26/2018 at 07:36PM

49
#108 - tenteke / @kuskus3

03/17/2019 at 06:00AM

49
#109 - Phoon / @justflashhim

05/10/2019 at 10:28PM

49
#110 - Lakhan Hake / @hake_lakhan

02/21/2021 at 12:34PM

57
#111 - IHateTweeting999 / @ITweeting999

05/05/2019 at 08:51PM

59
#112 - captain_morgan / @captain_morgan

10/13/2018 at 11:29PM

59
#113 - Vim Golfer / @VimGolfer6

08/28/2019 at 11:05AM

63
#114 - Jurica / @Jurica34581259

11/15/2018 at 12:34AM