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):
30
#1 - Saki Gw / @Sakigw

09/21/2018 at 01:42PM

30
#2 - Smylers / @Smylers2

09/21/2018 at 02:02PM

30
#3 - John Braxler / @braxler

09/21/2018 at 03:50PM

30
#4 - Jon Krause / @jkrause314

09/23/2018 at 01:32AM

30
#5 - Dax / @zacoxi

10/05/2018 at 06:16AM

30
#6 - Petro Тrouq / @zulolosi

10/28/2018 at 12:51PM

30
#7 - Turkey Man / @lvturkeyman

02/22/2019 at 09:01AM

30
#8 - alekfed / @alek_fed

04/15/2019 at 11:54AM

30
#9 - Grant / @grant_7788

05/02/2019 at 09:40AM

30
#10 - james_bunch / @james_bunch

05/03/2019 at 02:55AM

30
#11 - maximilian / @maximil61408276

05/23/2019 at 09:56PM

30
#12 - mkaminaga / @mkmng3

07/01/2019 at 08:33AM

30
#13 - Miłosz Łakomy / @foobar01123

08/01/2019 at 12:17PM

30
#14 - Viktor Styrud / @ViktorStyrud

10/16/2019 at 10:40AM

30
#15 - vimgolfer / @vimgolfer7

10/22/2019 at 04:42AM

30
#16 - chocolate / @chocola81394123

11/26/2020 at 06:11AM

30
#17 - A A A / @37fatos

01/25/2021 at 08:16PM

30
#18 - Jung Yeon Park / @park_jungy

02/05/2021 at 10:00PM

30
#19 - Jianfeng / @Jianfen22425058

02/08/2021 at 08:11AM

30
#20 - pikjes / @pikjes2

03/21/2021 at 03:25PM

30
#21 - Pedro Minicz / @pedrominicz

03/26/2022 at 05:08PM

30
#22 - math is what I hate / @mpnmbn

09/20/2022 at 07:54PM

30
#23 - Henrique Malheiro / @rike09

03/04/2023 at 10:38AM

30
#24 - Peppa Pig / @PeppaPi95550250

06/17/2024 at 04:36AM

31
#25 - Finn Francis / @FinnFrancis

10/27/2018 at 01:33AM

31
#26 - Mihai / @mihaicristiant

12/03/2018 at 08:11AM

31
#27 - 默罕默德 / @Rt6RjEAJ987Woes

02/17/2019 at 07:21AM

31
#28 - Gitsnik / @dracyrys

05/04/2019 at 11:05AM

31
#29 - Mario Olofo / @mario_olofo

10/24/2019 at 02:46AM

31
#30 - Lory / @Lory46845742

11/14/2019 at 09:56AM