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):
36
#61 - name / @name65894813

11/15/2018 at 03:52PM

36
#62 - Jonathan Gin / @jonathangin52

12/05/2018 at 10:13PM

36
#63 - Maas Lalani / @maaslalani

12/05/2018 at 10:15PM

36
#64 - Bennett / @bennettbackward

12/19/2018 at 11:52AM

36
#65 - churaki / @churaki

01/29/2019 at 11:36AM

36
#66 - amal / @cdsudama

02/03/2019 at 10:05PM

36
#67 - Wei Wen / @goweiwen

02/14/2019 at 07:49PM

36
#68 - Sherab Giovannini / @shaddycls

05/04/2019 at 09:36AM

36
#69 - Jason / @roosjason

06/15/2020 at 08:15AM

37
#70 - Marius Jurgelenas / @MarenasLT

09/21/2018 at 11:31AM

37
#71 - daniel / @daniel31464605

09/26/2018 at 07:46AM

37
#72 - Tom Smeding / @TomSmeding

11/05/2018 at 10:36PM

37
#73 - 永森 / @nagk05

11/18/2018 at 10:01AM

37
#74 - Rand Omperson / @197258444

04/17/2019 at 10:12PM

37
#75 - majo senf / @majo_senf

06/17/2019 at 08:57PM

37
#76 - Delon / @delonleonard

01/09/2020 at 11:55PM

37
#77 - John Doe / @JohnDoe75830353

06/04/2021 at 12:18AM

38
#78 - Edouard Piette / @EdPiette

10/09/2018 at 09:33AM

38
#79 - Nir Givon / @nir_givon

11/11/2018 at 02:12PM

38
#80 - PJ Frazer / @pj_frazer

12/02/2018 at 02:19AM

38
#81 - theBecwar / @thebecwar

08/19/2019 at 07:12PM

39
#82 - Gayan Munasinghe / @gayanm

09/23/2018 at 04:50PM

39
#83 - prince ducaca / @prince_du_caca

09/26/2018 at 09:46PM

39
#84 - Keldwik Chaldain / @Suskeyhose

10/03/2018 at 02:16AM

39
#85 - Dr Rev J. “I am not a bot!” Kirchartz, KSC, KHS / @JKirchartz

10/30/2018 at 07:15PM

39
#86 - unclewangshushu / @shuwushu

11/29/2018 at 05:11PM

39
#87 - Nicolas Daval / @ndaval

04/08/2019 at 06:22PM

39
#88 - José / @AngelGaldamez

05/25/2020 at 01:10AM

39
#89 - RockerZZY / @rocker_zzy

06/11/2020 at 09:27AM

39
#90 - Xzavie / @Xzavie3

02/25/2021 at 04:24AM