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

51 active golfers, 162 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

31
#7 - Finn Francis / @FinnFrancis

10/27/2018 at 01:33AM

31
#8 - Mihai / @mihaicristiant

12/03/2018 at 08:11AM

32
#9 - Steve Bitner / @fourbitbots

09/22/2018 at 03:30AM

32
#10 - golgi / @gloggyapparatus

10/02/2018 at 08:59AM

32
#11 - Benjamin Kiesl / @BenjaminKiesl

10/11/2018 at 02:37PM

32
#12 - Tuomas Jokioja / @TJokioja

10/12/2018 at 05:09PM

32
#13 - Sam Kim / @samkimhis

10/14/2018 at 04:50AM

32
#14 - François Marais / @maraisf

10/16/2018 at 02:37AM

32
#15 - Dima Matrohin / @wo_ogy

10/27/2018 at 10:39AM

33
#16 - Arijus / @argshook

09/21/2018 at 11:18AM

33
#17 - Not real / @Notreal70353016

09/21/2018 at 07:52PM

33
#18 - Ole Mussmann / @isbjornlabs

10/28/2018 at 01:32PM

34
#19 - Roger Bongers / @RogerBongers

10/02/2018 at 06:04PM

35
#20 - Per Forser / @perforcer

09/21/2018 at 04:18PM

36
#21 - tPenguinLTG / @tpenguinltg

09/23/2018 at 05:11PM

36
#22 - Rasmus Bergström / @JRasmusBm

09/25/2018 at 04:06PM

36
#23 - Dave Brda / @BrdaDave

10/25/2018 at 09:16PM

36
#24 - name / @name65894813

11/15/2018 at 03:52PM

36
#25 - Jonathan Gin / @jonathangin52

12/05/2018 at 10:13PM

36
#26 - Maas Lalani / @maaslalani

12/05/2018 at 10:15PM

37
#27 - Marius Jurgelenas / @MarenasLT

09/21/2018 at 11:31AM

37
#28 - daniel / @daniel31464605

09/26/2018 at 07:46AM

37
#29 - Tom Smeding / @TomSmeding

11/05/2018 at 10:36PM

37
#30 - 永森 / @nagakei05

11/18/2018 at 10:01AM