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

63 active golfers, 186 entries

Leaderboard (lowest score wins):
38
#31 - Ricardo Lima / @ricponteslima

03/07/2016 at 02:37PM

38
#32 - Carlos A Henríquez Q / @lagunex

03/13/2016 at 03:52PM

39
#33 - John Smith / @literacyisgood

02/13/2016 at 12:10PM

39
#34 - Michel Ganguin / @tinycrazyfish

03/03/2016 at 11:57AM

39
#35 - Daniel / @Daniel00288663

03/31/2017 at 01:37PM

39
#36 - Gurukandhamoorthi / @Gurukandhamoor1

07/23/2017 at 03:14PM

40
#37 - Martin Lehmann / @Theneva

01/24/2016 at 02:26AM

40
#38 - RockerZZY / @rocker_zzy

07/21/2020 at 02:58AM

40
#39 - Arya Kumar / @SusSquirrel

05/23/2021 at 03:28PM

41
#40 - Todd Branchflower / @toddbranch

01/22/2016 at 05:19PM

41
#41 - Thijs van den Anker / @thijsvdanker

02/15/2016 at 08:10PM

41
#42 - Kyouma / @kyoumaJohn

10/14/2016 at 08:23PM

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

10/23/2020 at 03:53PM

42
#44 - Samuel Masuy / @samasuy

01/23/2016 at 01:40AM

42
#45 - DHM / @DHM29978992

05/15/2018 at 03:26AM

43
#46 - RobertT / @techrt2050

01/28/2016 at 06:26AM

43
#47 - Roland Hougs / @roland_b_h

01/31/2016 at 07:38PM

43
#48 - Cristian Lupașcu / @clupasq

02/02/2016 at 03:47PM

44
#49 - Gerald Tilma / @GeraldTilma

02/04/2016 at 01:51AM

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

07/10/2017 at 05:49PM

45
#51 - Michael Prouty / @MProuts

01/25/2016 at 06:55PM

46
#52 - Domingue Justin / @_jdomingue

01/26/2016 at 08:36PM

46
#53 - Will / @obiwan__k3n00bi

08/18/2016 at 05:24AM

47
#54 - Kostas / @blackraven_13

02/22/2016 at 08:23PM

47
#55 - Ifeoluwa Lawal / @IfeLawl

10/23/2020 at 04:00PM

49
#56 - Christopher Wells / @ExcaliburZero_Z

01/27/2016 at 03:22AM

50
#57 - Maciej Woźniak / @eldhash

01/23/2016 at 11:21PM

52
#58 - Marshall Croes / @marshallcroes

01/25/2016 at 04:06PM

53
#59 - Cory Knapp / @coryknapp

01/22/2016 at 10:31PM

58
#60 - vimcoder / @Khanal12Uttam

01/22/2016 at 08:02PM