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 40 remaining solutions by signing in and submitting your own entry
#41 Michael Prouty / MProuts - Score: 45 - 01/25/16 @ 18:55
ywPa<CR><Esc>qqcw<Tab>.setIn(<Esc>f]cw, <Esc>f c2w, <Esc>A)<Esc>j^q4@qZZ

0 comments


#42 Domingue Justin / _jdomingue - Score: 46 - 01/26/16 @ 20:36
yawPa<CR><Esc>qqcfs<Tab>.setIn(<Esc>f]2s, <Esc>f 2s,<Esc>A)<Esc>0j0q4@qZZ

0 comments


#43 Will / obiwan__k3n00bi - Score: 46 - 08/18/16 @ 05:24
yawPa<CR><Esc>qqcfs<Tab>.setIn(<Esc>f]2s, <Esc>f 2s,<Esc>A)<Esc>0j0q4@qZZ

0 comments


#44 Kostas / blackraven_13 - Score: 47 - 02/22/16 @ 20:23
Olines<Esc>+<C-V>Gfsc<Tab>.setIn(<Esc>qqf]R, <Esc>f vlc,<Esc>A)<Esc>+q4@qZZ

0 comments


#45 Christopher Wells / ExcaliburZero_Z - Score: 49 - 01/27/16 @ 03:22
Olines<Esc>qaj0dwi<Tab>.setIn(<Esc>2w2xi, <Esc>2ea,<Esc>w2x$a)<Esc>q4@aZZ

0 comments


#46 Maciej Woźniak / eldhash - Score: 50 - 01/23/16 @ 23:21
ywO<Esc>p:%<BS>2,6norm cw<Tab>.setIn(<C-V><Esc>f]c2l, <C-V><Esc>f .xA)<C-V><Esc><CR>:wq<CR>

0 comments


#47 Marshall Croes / marshallcroes - Score: 52 - 01/25/16 @ 16:06
yw<C-V>Gec<Tab>.setIn(<Esc>$<C-V>G$A)<Esc>:%s/ = /, <CR>:%s/\]\[/, <CR>HO<C-R>0<Esc>ZZ

0 comments


#48 coryknapp / coryknapp - Score: 53 - 01/22/16 @ 22:31
qqdwi<Tab>.setIn(/<BS><Esc>/]<CR>xxi, <Esc>/=<CR>xi<BS>,<Esc>$a)<Esc>j0q4@qHOlines<Esc>ZZ

0 comments


#49 vimcoder / Khanal12Uttam - Score: 58 - 01/22/16 @ 20:02
YPf[Dj^<C-V>Ges.setIn(<Esc>:%s/\]\[/, /g<CR>:%s/ =/,/g<CR>V2G>gv<C-V>o$A)<Esc>ZZ

0 comments


#50 Shalldök / shalldoek - Score: 58 - 01/24/16 @ 18:03
YPf[Dj^<C-V>Ges.setIn(<Esc>:%s/\]\[/, /g<CR>:%s/ =/,/g<CR>V2G>gv<C-V>o$A)<Esc>ZZ

hermanjunge: "Borrowed"

1 comment


#51 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

51 active golfers, 137 entries

Leaderboard (lowest score wins):
35
#1 - Jon Krause / jkrause314

01/22/2016 at 05:42PM

35
#2 - Urtica dioica / udioica

01/22/2016 at 10:54PM

35
#3 - Roberto Carraretto / robcarraretto

01/22/2016 at 10:57PM

35
#4 - Petro Тrouq / zulolosi

01/24/2016 at 12:41AM

35
#5 - Alan Kang / alankang

01/25/2016 at 02:01PM

35
#6 - John Braxler / braxler

01/25/2016 at 03:21PM

35
#7 - Hawk Newton / hawknewton

01/26/2016 at 05:24AM

35
#8 - Austin Wood / indiesquidge

01/26/2016 at 05:51PM

35
#9 - Frederik Klama / fklama

01/27/2016 at 11:57AM

35
#10 - Smylers / Smylers2

01/27/2016 at 03:59PM

35
#11 - Saki Gw / Sakigw

01/28/2016 at 03:56PM

35
#12 - Daniel Suh / 18kehops

02/02/2016 at 03:47PM

35
#13 - Mathias Andersson / Wraul

02/13/2016 at 08:58PM

35
#14 - ben kavanagh / bkava

02/19/2016 at 06:16AM

35
#15 - Janko Jerinic / JankoJerinic

03/26/2016 at 07:13AM

35
#16 - Dinesh Bhosale / MrDineshBhosale

04/01/2016 at 03:17PM

35
#17 - Ram Tamtam / ramtamtamtam

07/06/2016 at 09:38AM

35
#18 - Turkey Man / lvturkeyman

11/26/2017 at 10:23AM

36
#19 - Matthieu Crapet / mcr05

01/31/2016 at 10:17AM

36
#20 - Dimitar Dimitrov / kurkale6ka

03/09/2016 at 04:45PM

36
#21 - Chenut Ludovic / 7Brwa7

04/11/2016 at 08:29AM

37
#22 - Ralf Haffa / fatslo

02/28/2016 at 01:39PM

38
#23 - Sebastian Pardo / sebpardo

02/29/2016 at 07:57AM

38
#24 - Ricardo Lima / ricponteslima

03/07/2016 at 02:37PM

38
#25 - Carlos A Henríquez Q / lagunex

03/13/2016 at 03:52PM

39
#26 - John Smith / literacyisgood

02/13/2016 at 12:10PM

39
#27 - Michel Ganguin / tinycrazyfish

03/03/2016 at 11:57AM

39
#28 - Daniel / Daniel00288663

03/31/2017 at 01:37PM

39
#29 - Gurukandhamoorthi / Gurukandhamoor1

07/23/2017 at 03:14PM

40
#30 - Martin Lehmann / Theneva

01/24/2016 at 02:26AM