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):
34
#1 - vladanscy / @vladanscy

02/24/2023 at 03:48PM

34
#2 - Peppa Pig / @PeppaPi95550250

06/08/2024 at 09:14AM

34
#3 - nickGPT / @nickandbro

08/28/2024 at 03:39AM

35
#4 - Jon Krause / @jkrause314

01/22/2016 at 05:42PM

35
#5 - Urtica dioica / @udioica

01/22/2016 at 10:54PM

35
#6 - Roberto Carraretto / @robcarraretto

01/22/2016 at 10:57PM

35
#7 - Petro Тrouq / @zulolosi

01/24/2016 at 12:41AM

35
#8 - Alan Kang / @alankang

01/25/2016 at 02:01PM

35
#9 - John Braxler / @braxler

01/25/2016 at 03:21PM

35
#10 - Hawk Newton / @hawknewton

01/26/2016 at 05:24AM

35
#11 - Austin Wood / @indiesquidge

01/26/2016 at 05:51PM

35
#12 - Frederik Klama / @fklama

01/27/2016 at 11:57AM

35
#13 - Smylers / @Smylers2

01/27/2016 at 03:59PM

35
#14 - Saki Gw / @Sakigw

01/28/2016 at 03:56PM

35
#15 - Daniel Suh / @18kehops

02/02/2016 at 03:47PM

35
#16 - Mathias Andersson / @Wraul

02/13/2016 at 08:58PM

35
#17 - ben kavanagh / @bkava

02/19/2016 at 06:16AM

35
#18 - Janko Jerinic / @JankoJerinic

03/26/2016 at 07:13AM

35
#19 - Dinesh Bhosale / @MrDineshBhosale

04/01/2016 at 03:17PM

35
#20 - Ram Tamtam / @ramtamtamtam

07/06/2016 at 09:38AM

35
#21 - Turkey Man / @lvturkeyman

11/26/2017 at 10:23AM

36
#22 - Matt / @mcr05

01/31/2016 at 10:17AM

36
#23 - Dimitar Dimitrov / @kurkale6ka

03/09/2016 at 04:45PM

36
#24 - Chenut Ludovic / @7Brwa7

04/11/2016 at 08:29AM

36
#25 - Mihai / @mihaicristiant

03/27/2019 at 07:49AM

36
#26 - Jean George / @JeanGeo20504212

05/24/2022 at 02:33PM

36
#27 - constap / @constap

05/04/2024 at 03:26PM

37
#28 - Ralf Haffa / @fatslo

02/28/2016 at 01:39PM

37
#29 - Leland Paul Kusmer / @lelandpaul

10/23/2020 at 03:56PM

38
#30 - Sebastian Pardo / @sebpardo

02/29/2016 at 07:57AM