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):
45
#121 - GrimmT / @GrimmT10

12/23/2019 at 06:25PM

46
#122 - Paul Inc / @hiniol1982

10/26/2018 at 07:36PM

49
#123 - tenteke / @kuskus3

03/17/2019 at 06:00AM

49
#124 - Phoon / @justflashhim

05/10/2019 at 10:28PM

49
#125 - Lakhan Hake / @hake_lakhan

02/21/2021 at 12:34PM

57
#126 - IHateTweeting999 / @ITweeting999

05/05/2019 at 08:51PM

59
#127 - captain_morgan / @captain_morgan

10/13/2018 at 11:29PM

59
#128 - Vim Golfer / @VimGolfer6

08/28/2019 at 11:05AM

63
#129 - Jurica / @Jurica34581259

11/15/2018 at 12:34AM