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):
58
#61 - Shalldök / @shalldoek

01/24/2016 at 06:03PM

75
#62 - Matthew Beaumont / @mattybeau_dev

11/26/2021 at 02:18PM

78
#63 - Tim Suchanek / @TimSuchanek

01/22/2016 at 05:10PM