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 56a260eedb173f2f5d00f6f8

JS notation to Immutable.js notation

Now Immutable.js made its way into many frontends. This challenge consists of a typical refactoring that many of us are facing now.

Start file
lines[1][1] = 'hello'
lines[2][0] = 'world'
lines[3][1] = 'whats'
lines[10][2] = 'going'
lines[12][1] = 'on'
End file
lines
	.setIn([1, 1], 'hello')
	.setIn([2, 0], 'world')
	.setIn([3, 1], 'whats')
	.setIn([10, 2], 'going')
	.setIn([12, 1], 'on')

View Diff

1,5c1,6
< lines[1][1] = 'hello'
< lines[2][0] = 'world'
< lines[3][1] = 'whats'
< lines[10][2] = 'going'
< lines[12][1] = 'on'
---
> lines
> 	.setIn([1, 1], 'hello')
> 	.setIn([2, 0], 'world')
> 	.setIn([3, 1], 'whats')
> 	.setIn([10, 2], 'going')
> 	.setIn([12, 1], 'on')

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 58 remaining solutions by signing in and submitting your own entry
#59 Tim Suchanek / @TimSuchanek - Score: 78 - 01/22/16 @ 17:10
VG:s/lines\[\(.*\)\]\[\(.*\)\]\s=\s'\(.*\)'/<Tab>.setIn([\1, \2], '\3')<CR>{Olines<Esc>ZZ

0 comments


Created by: @TimSuchanek

59 active golfers, 155 entries

Leaderboard (lowest score wins):
39
#31 - Daniel / @Daniel00288663

03/31/2017 at 01:37PM

39
#32 - Gurukandhamoorthi / @Gurukandhamoor1

07/23/2017 at 03:14PM

40
#33 - Martin Lehmann / @Theneva

01/24/2016 at 02:26AM

40
#34 - RockerZZY / @rocker_zzy

07/21/2020 at 02:58AM

40
#35 - Arya Kumar / @SusSquirrel

05/23/2021 at 03:28PM

41
#36 - Todd Branchflower / @toddbranch

01/22/2016 at 05:19PM

41
#37 - Thijs van den Anker / @thijsvdanker

02/15/2016 at 08:10PM

41
#38 - Kyouma / @kyoumaJohn

10/14/2016 at 08:23PM

41
#39 - vim-golf-requirement / @VRequirement

10/23/2020 at 03:53PM

42
#40 - Samuel Masuy / @samasuy

01/23/2016 at 01:40AM

42
#41 - DHM / @DHM29978992

05/15/2018 at 03:26AM

43
#42 - RobertT / @techrt2050

01/28/2016 at 06:26AM

43
#43 - Roland Hougs / @OminousWater

01/31/2016 at 07:38PM

43
#44 - Cristian Lupașcu / @clupasq

02/02/2016 at 03:47PM

44
#45 - Gerald Tilma / @GeraldTilma

02/04/2016 at 01:51AM

44
#46 - Михаил Добров / @mSuGfwFz2ZNvv5b

07/10/2017 at 05:49PM

45
#47 - Michael Prouty / @MProuts

01/25/2016 at 06:55PM

46
#48 - Domingue Justin / @_jdomingue

01/26/2016 at 08:36PM

46
#49 - Will / @obiwan__k3n00bi

08/18/2016 at 05:24AM

47
#50 - Kostas / @blackraven_13

02/22/2016 at 08:23PM

47
#51 - Ifeoluwa Lawal / @IfeLawl

10/23/2020 at 04:00PM

49
#52 - Christopher Wells / @ExcaliburZero_Z

01/27/2016 at 03:22AM

50
#53 - Maciej Woźniak / @eldhash

01/23/2016 at 11:21PM

52
#54 - Marshall Croes / @marshallcroes

01/25/2016 at 04:06PM

53
#55 - Cory Knapp / @coryknapp

01/22/2016 at 10:31PM

58
#56 - vimcoder / @Khanal12Uttam

01/22/2016 at 08:02PM

58
#57 - Shalldök / @shalldoek

01/24/2016 at 06:03PM

75
#58 - Matthew Beaumont / @mattybeau_dev

11/26/2021 at 02:18PM

78
#59 - Tim Suchanek / @TimSuchanek

01/22/2016 at 05:10PM