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 28 remaining solutions by signing in and submitting your own entry
#29 captain_morgan / @captain_morgan - Score: 59 - 10/13/18 @ 23:29
:<50-53>%s/.*'\(\w\+\)', \(\w\+\)./state.\1 = payload.\2<Esc>[201~<CR>ZZ

0 comments


Created by: @argshook

29 active golfers, 104 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 - 张超 / @zacoxi

10/05/2018 at 06:16AM

32
#6 - Steve Bitner / @fourbitbots

09/22/2018 at 03:30AM

32
#7 - golgi | LISTEN TO 4MEN430 - DOUBLE TAKE / @gloggyapparatus

10/02/2018 at 08:59AM

32
#8 - Benjamin Kiesl / @BenjaminKiesl

10/11/2018 at 02:37PM

32
#9 - Tuomas Jokioja / @TJokioja

10/12/2018 at 05:09PM

32
#10 - Sam Kim / @samkimhis

10/14/2018 at 04:50AM

32
#11 - François Marais / @maraisf

10/16/2018 at 02:37AM

33
#12 - Arijus / @argshook

09/21/2018 at 11:18AM

33
#13 - Not real / @Notreal70353016

09/21/2018 at 07:52PM

34
#14 - Roger Bongers / @RogerBongers

10/02/2018 at 06:04PM

35
#15 - Per Forser / @perforcer

09/21/2018 at 04:18PM

36
#16 - tPenguinLTG / @tpenguinltg

09/23/2018 at 05:11PM

36
#17 - Rasmus Bergström / @JRasmusBm

09/25/2018 at 04:06PM

37
#18 - Marius Jurgelenas / @MarenasLT

09/21/2018 at 11:31AM

37
#19 - daniel / @daniel31464605

09/26/2018 at 07:46AM

38
#20 - Edouard Piette / @EdPiette

10/09/2018 at 09:33AM

39
#21 - Gayan Munasinghe / @gayanm

09/23/2018 at 04:50PM

39
#22 - prince ducaca / @prince_du_caca

09/26/2018 at 09:46PM

39
#23 - Keldwik Chaldain / @Suskeyhose

10/03/2018 at 02:16AM

42
#24 - masterpi / @masterpi16

09/23/2018 at 03:17PM

42
#25 - John Oleksowicz / @JohnOlek

10/05/2018 at 06:37PM

42
#26 - Jan Wedekind / @wedesoft

10/13/2018 at 08:11PM

43
#27 - Anoop Kumar / @anooplive

09/21/2018 at 01:09PM

43
#28 - Mauricio Ariza / @_hell_spawn

09/26/2018 at 01:20PM

59
#29 - captain_morgan / @captain_morgan

10/13/2018 at 11:29PM