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 4d1e29fda93ce03311000066

Ruby 1.9 hashes

Rubyists talk about being cutting edge but how many are using 1.9 in production? Time to convert those verbose 1.8 hashes in to symbolic, succinct 1.9 beauties!

Start file
{
  :a => 1,
  :b => 2,
  :c => 3
}
End file
{
  a: 1,
  b: 2,
  c: 3
}

View Diff

2,4c2,4
<   :a => 1,
<   :b => 2,
<   :c => 3
---
>   a: 1,
>   b: 2,
>   c: 3

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 274 remaining solutions by signing in and submitting your own entry
#275 Oliver Christ / 0liverChrist - Score: 17 - 09/25/13 @ 22:01
qa+xa:<Esc>ldf>q2@aZZ

0 comments


#276 Caleb Perkins / tollbooth - Score: 17 - 01/29/14 @ 09:38
jll<C-V>jjxpl<C-V>jjlldZZ

0 comments


#277 Tj / yrddy - Score: 17 - 08/19/14 @ 06:31
qa+xa:<Esc>ldf>q2@aZZ

0 comments


#278 Kiet Nguyen / kietnguyen86 - Score: 17 - 03/08/15 @ 08:14
jw<C-V>jjxl<C-V>jjllc:<Esc>ZZ

0 comments


#279 Isac Sacchi e Souza / isacssouza - Score: 18 - 12/31/10 @ 22:43
:%s/:<CR>:%s/ =>/:<CR>ZZ

0 comments


#280 Simon Jefford / simonj - Score: 18 - 01/01/11 @ 11:25
jqqwxplxxxj0q2@qZZ

0 comments


#281 okay zed / okayzed - Score: 18 - 01/03/11 @ 15:59
jw<C-V>2jdl<C-V>jjllc:<Esc><C-Z>ZZ

0 comments


#282 Vladimir Parfinenko / cypok - Score: 18 - 01/19/11 @ 05:07
:%s/:<CR>:%s/ =>/:<CR>ZZ

0 comments


#283 Jon Allured / jonallured - Score: 18 - 09/14/11 @ 01:50
:%s/:<CR>:%s/ =>/:<CR>ZZ

0 comments


#284 Benjamin Sullivan / benjaminsull - Score: 18 - 12/06/11 @ 15:26
/:<CR>qqxpldt nq2@qZZ

0 comments


#285 Daniel Harrington / rubiii - Score: 18 - 12/10/11 @ 20:26
qq/:<CR>xpldf>q2@q:x<CR>

0 comments


#286 vansan / VinceVansan - Score: 18 - 08/21/12 @ 21:12
jw<C-V>jjXl<C-V>jjllc:<Esc><Esc>ZZ

0 comments


#287 Tyler J. Kuhn / blackwatertepes - Score: 18 - 08/27/12 @ 16:44
:%s/:<CR>:%s/ =>/:<CR>ZZ

0 comments


#288 Domon / Domon - Score: 18 - 09/11/12 @ 09:52
:%s/ =>/:/g<CR><C-V>kkxZZ

0 comments


#289 Vim London / VimLondon - Score: 18 - 11/27/12 @ 21:20
:%s/:<CR>:%s/ =>/:<CR>ZZ

0 comments


#290 Woojung Kim 김우중 / _kimwz - Score: 18 - 07/15/13 @ 05:16
:%s/ =>/:/g<CR><C-V>2kxZZ

0 comments


#291 Fontaine Kévin / DotSlash974 - Score: 18 - 11/16/13 @ 18:57
/:<CR><C-V>2jxpf=<C-V>2j2lxZZ

0 comments


#292 Almog / almog - Score: 18 - 05/07/14 @ 12:54
qq/:<CR>xlc3l:<Esc>q2@qZZ

0 comments


#293 Kristijan Husak / kristijan_husak - Score: 18 - 02/03/15 @ 08:39
/><CR><C-V>2jF c:<Esc>^<C-V>2jxZZ

0 comments


#294 Zuzana Dostalova / Jocinka - Score: 18 - 03/14/15 @ 15:09
w<C-V>jjxl<C-V>jjllc:<Esc>:wq<CR>

0 comments


#295 William Ott / oddalot - Score: 18 - 04/11/15 @ 14:29
:%s/:<CR>:%s/ =>/:<CR>ZZ

0 comments


#296 ltn614 / ltn614 - Score: 18 - 09/21/15 @ 07:40
/:<CR>qqxpldf>nq2@qZZ

0 comments


#297 Etienne Tremel / etiennetremel - Score: 18 - 02/07/16 @ 21:09
<CR>qqxlct :<Esc>jhq2@qZZ

0 comments


#298 Gurukandhamoorthi / Gurukandhamoor1 - Score: 18 - 07/13/17 @ 12:12
/:<CR><C-V>jjdpll<C-V>jjllxZZ

0 comments


#299 Liam Chimes / ChimesLiam - Score: 18 - 05/02/18 @ 13:41
:%s/ =>/:/g<CR><C-V>kkdZZ

0 comments


#300 Kornél Lugosi / Coornail - Score: 19 - 01/08/11 @ 10:33
qaj^<Del>ld2wi: <Esc>q2@aZZ

0 comments


#301 codegourmet / codegourmet - Score: 19 - 10/02/13 @ 12:40
:g/:/no<S-Tab> ^xlc3l:<CR>ZZ

0 comments


#302 Patrick Pitoscia / Patrick03960431 - Score: 19 - 08/10/14 @ 04:20
:%s/ => / /<CR><C-V>2kxpZZ

0 comments


#303 z0c / zerocabal - Score: 19 - 06/12/18 @ 08:59
:%s/ =>/:/g<CR>xkxkxZZ

0 comments


#304 libicocco / libicocco - Score: 20 - 12/31/10 @ 19:37
:%s/:\(.\) =>/\1:<CR>ZZ

0 comments


#305 Ricardo Sisnett / mrjackinc - Score: 20 - 01/02/11 @ 05:21
:%s/:\(.\) =>/\1:<CR>ZZ

0 comments


#306 n / kivran - Score: 20 - 01/03/11 @ 15:52
qq/:<CR>xpldf>q2@q<Esc>:wq<CR>

0 comments


#307 Pablo Villalba / micho - Score: 20 - 01/09/11 @ 15:02
:%s/:\(.\) =>/\1:<CR>ZZ

0 comments


#308 Duff OMelia / duffomelia - Score: 20 - 04/18/11 @ 10:40
jll<C-V>jjdl<C-V>jjllc:<Esc>:wq<CR>

0 comments


#309 IPhone Notiz / MyIPhoneNotes - Score: 20 - 11/10/11 @ 16:57
jqqwxpl3xj0q2@q:w<CR>ZZ

0 comments


#310 Joe Nerdan / JoeNerdan - Score: 20 - 12/19/11 @ 22:58
:%s#:\(.\) =>#\1:<CR>ZZ

0 comments


#311 matthew / mdespuits - Score: 20 - 02/02/12 @ 19:29
jqq2lxl3xi:<Esc>j0q2@qZZ

0 comments


#312 Lily / lilibethdlc - Score: 20 - 03/06/12 @ 03:41
:%s/:\(.\) =>/\1:<CR>ZZ

0 comments


#313 Axl Waii / axlwaii - Score: 20 - 09/07/12 @ 06:49
:%s/:<CR>:%s/ =>/:<CR>:wq<CR>

0 comments


#314 Andy L / akleak - Score: 20 - 10/16/12 @ 13:08
:%s/:<CR>kklct :<Esc>j.j.ZZ

0 comments


#315 Aaron Tinio / aptinio - Score: 20 - 10/24/12 @ 14:09
:%s/:\(.\) =>/\1:<CR>ZZ

0 comments


#316 Adam Licht / aal85255 - Score: 20 - 10/22/13 @ 03:42
:%s/:<CR>:%s/ =>/:<CR>:wq<CR>

0 comments


#317 André Branco / avbranco - Score: 20 - 08/30/14 @ 20:16
:%s/:\(.\) =>/\1:<CR>ZZ

0 comments


#318 larsd / larsd - Score: 21 - 12/31/10 @ 20:47
:%s/:\(.\) =>/\1:/<CR>ZZ

0 comments


#319 neleai / enlaei - Score: 21 - 12/31/10 @ 22:10
:%s/:\(.\) =>/\1:<CR>:x<CR>

0 comments


#320 Guillaume Bonnoron / gbonnoron - Score: 21 - 12/31/10 @ 22:48
:%s/:\(\l\) =>/\1:<CR>ZZ

0 comments


#321 garygordon / garygordon - Score: 21 - 01/02/11 @ 15:09
:%s/:\(.\) =>/\1:/<CR>ZZ

0 comments


#322 Dj Vimgolf / dj_vimgolf - Score: 21 - 01/14/12 @ 17:46
:%s/:\(\l\) =>/\1:<CR>ZZ

0 comments


#323 Christopher Brew / Seph1rothVII - Score: 21 - 01/17/12 @ 22:26
:%s/:\(\a\) =>/\1:<CR>ZZ

0 comments


#324 Nathaniel Barnes / NathanielBarnes - Score: 21 - 06/21/12 @ 05:48
wxjxjx:%s/ =>/:/g|wq<CR>

0 comments


#325 CHIP CASTLE / chipcastle - Score: 21 - 12/27/13 @ 04:50
:%s/://<CR>:%s/ =>/:<CR>:x<CR>

0 comments


#326 matti jauhiainen / GmTapio - Score: 21 - 01/28/14 @ 21:19
kkkjqqwxplxxxj0q2@qZZ

0 comments


#327 Daniel Grippi / danielgrippi - Score: 22 - 12/31/10 @ 19:36
:%s/:\(.\) =>/\1:/g<CR>ZZ

0 comments


#328 Gonzih / Gonzih - Score: 22 - 03/24/11 @ 15:08
:%s/://|%s/\s=>/:/|wq<CR>

0 comments


#329 Jyun-Fan Tsai / fakecolor - Score: 22 - 02/11/12 @ 01:00
:%s/:\(.\) =>/\1:/g<CR>ZZ

0 comments


#330 Siripong Boonchaiya / siripong - Score: 23 - 01/01/11 @ 03:31
:%s/\v:(.)\ \=\>/\1:<CR>ZZ

0 comments


#331 kārlis / skazhy - Score: 23 - 01/03/11 @ 10:48
:%s/://<CR>:%s/ =>/:/<CR>:wq<CR>

0 comments


#332 Brian / bglusman - Score: 23 - 02/06/12 @ 14:39
:%s/://<CR>:%s/ =>/:/<CR>:wq<CR>

0 comments


#333 Trever Marshall / dynamic_library - Score: 23 - 10/12/12 @ 20:33
:%s/://<CR>:5<BS>%s/ =>/:/<CR>ZZ

0 comments


#334 Charlie Massry / charlesmassry - Score: 24 - 09/03/14 @ 00:24
jll<C-V>jjxl<C-V>jjI:<Esc>l<C-V>jljlx:x<CR>

0 comments


#335 fuku1026 / fukusuke1026 - Score: 24 - 07/13/17 @ 13:59
jwxjxjxpkPkPw3xj.j.<Esc>:wq<CR>

0 comments


#336 aimee / sermoa - Score: 25 - 01/02/11 @ 20:38
:%s/:\(\w\+\) =>/\1:/g<CR>ZZ

sermoa: I know i could do it simpler for this particular file, but i wanted to make a generic solution. I think i'll save this as a macro and use it whenever i want to convert hashes on a whole file! :)

rpattabi: is /g required?

2 comments


#337 Wojciech Pietrzak / astropanic - Score: 25 - 06/15/11 @ 12:58
:%s/ =>/:/g<CR>:%s/ :/ /g<CR>ZZ

0 comments


#338 Avijit Gupta / 526avijit - Score: 25 - 03/25/17 @ 08:20
:5<BS>%s/\:\(\w\) =>/\1\:<CR>ZZ

0 comments


#339 Mike Perham / mperham - Score: 27 - 01/30/11 @ 23:22
:%s/:\(\w*\) =>/\q<BS>1:/<CR>:wq<CR>

0 comments


#340 Joe Auricchio / jauricchio - Score: 28 - 01/01/11 @ 00:29
:%s/:\(\w\w*\) =>/\1:/g<CR>:wq<CR>

0 comments


#341 Feanor Celebrimbor / tumbaletaurea - Score: 28 - 06/02/12 @ 20:39
wxjxjxpkhpkhpldwdwuudej.j.ZZ

0 comments


#342 BiHi / BiHi - Score: 28 - 06/14/12 @ 12:01
:%s/:\(\w\+\)\s\+=>/\1:/g<CR>ZZ

0 comments


#343 Ed Gibbs / edward_gibbs - Score: 39 - 10/05/11 @ 15:59
:%s/\s=>//g<CR>x<Up>x<Up>x<Right>:<BS>i:<Down><Left>i:<BS><BS>:<Down><Left>:<Esc>:w<CR>:q<CR>

0 comments


Created by: jamesconroyfinn

343 active golfers, 1022 entries

Leaderboard (lowest score wins):
12
#1 - Glenn / spamcow_moo

01/04/2011 at 07:17PM

12
#2 - Marc Lacoursière / RooSoft

01/04/2011 at 11:02PM

12
#3 - aaaa3331 / aaaa3331

01/05/2011 at 12:32AM

12
#4 - Wei Dai / clvv42

01/05/2011 at 04:51AM

12
#5 - derp derp / derp__

01/05/2011 at 07:48PM

12
#6 - Ujjwol Lamichhane / Ujjwol

01/07/2011 at 10:21AM

12
#7 - Paul Tarjan / ptarjan

01/08/2011 at 10:08AM

12
#8 - Clive Evans / swish_bob

01/13/2011 at 09:36PM

12
#9 - Thomas Schönwälder / Masei1988

01/15/2011 at 05:04PM

12
#10 - Jacob Maine / jacobmaine

01/15/2011 at 08:58PM

12
#11 - ls lahrs / lslah

01/17/2011 at 03:23PM

12
#12 - Rob Ciaccio / RobertoCalavera

01/20/2011 at 09:18AM

12
#13 - Oleg Roshupkin / jjjahson

01/20/2011 at 09:37AM

12
#14 - Michał Taszycki / mehowte

01/24/2011 at 03:16PM

12
#15 - xhtmlforum / xhtmlforum

01/24/2011 at 09:19PM

12
#16 - Federico Galassi / federicogalassi

01/26/2011 at 05:41AM

12
#17 - Eivind Jahren / HaskellElephant

02/02/2011 at 09:19PM

12
#18 - Joost / vlabakje

02/12/2011 at 05:58PM

12
#19 - Pavlo Klets / p01nt

02/25/2011 at 10:44AM

12
#20 - vg / vimgolfer

02/27/2011 at 09:33PM

12
#21 - Dragan Cvetinovic / kawkafi

05/08/2011 at 11:00AM

12
#22 - (Emile (Swarts)) / EmileSwarts

06/07/2011 at 09:46PM

12
#23 - Stuart Gale / bishboria

06/19/2011 at 12:34AM

12
#24 - not so punk :] / notsopunk

06/19/2011 at 04:28PM

12
#25 - Johan Sveholm / rymdtjuren

06/30/2011 at 08:21AM

12
#26 - Hu Junfeng / junfeng

07/22/2011 at 02:56PM

12
#27 - Dave / zzdave13

07/26/2011 at 06:36PM

12
#28 - Sergey Kim / skim1776

08/10/2011 at 10:37AM

12
#29 - Trevor Powell / DoomedBunnies

12/01/2011 at 06:35AM

12
#30 - You-Siang Lin / yslinnctu

12/02/2011 at 11:55AM