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

Braces or Brackets?

Someone forgot whether to use braces or brackets and you have to clean up their code!

Start file
var some_function = function {arg1, arg2} [
	var some_array = (1, 2, 3, 4, 'foo');
	for {var i in some_array} (
		console.log(some_array, [{1 + (8 / 2)}, 'hello (world)');
	)
];
End file
var some_function = function (arg1, arg2) {
	var some_array = [1, 2, 3, 4, 'foo'];
	for (var i in some_array) {
		console.log(some_array, [(1 + (8 / 2)), 'hello (world)');
	}
};

View Diff

1,6c1,6
< var some_function = function {arg1, arg2} [
<       var some_array = (1, 2, 3, 4, 'foo');
<       for {var i in some_array} (
<               console.log(some_array, [{1 + (8 / 2)}, 'hello (world)');
<       )
< ];
---
> var some_function = function (arg1, arg2) {
>       var some_array = [1, 2, 3, 4, 'foo'];
>       for (var i in some_array) {
>               console.log(some_array, [(1 + (8 / 2)), 'hello (world)');
>       }
> };

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 349 remaining solutions by signing in and submitting your own entry
#350 biloute02 / @biloute02 - Score: 523 - 04/27/24 @ 12:16
<Esc>:g<BS>_<BS>+<BS>!@#$<BS><BS><BS><BS>&*()<BS><BS><BS><BS>()_+<BS><BS><BS><BS>1<BS>[]\<BS><BS>!<BS><BS>1<BS>[]\'{}|<BS><BS><BS><BS><BS><BS>_)(*&^%$#@!<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>+_)(*&^%$#@!<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>%^<BS><BS>%s<BS>s.<BS>/<Esc>xu:s?<BS><BS>gs<BS><BS>5<BS>%<BS>%s<CR>:mn<BS>an :s<CR>V<Esc>:,<BS>.f<BS><BS>s<BS>g<BS>k<BS>l<BS>hl<BS>elp :c<BS>s<CR><C-D><C-U><C-D><C-D><C-D><C-U><C-U><C-U><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-U><C-U>:hie<BS><BS>u<BS>f<BS>o<BS>l<BS>e<BS>elp range<CR>:%/{/[?<BS>/g<CR>q:<Up><Right>is<CR><Esc><Esc>:q<CR>q:<Up><Up><CR>:<Esc>s<Esc>uuq:<Up><Right><Right><Right><Right><Right>r0r)r(<CR>q:<Up><Right><Right><Right>r}llr)<CR>q:<Up><Right><Right><Right>r[llr{<CR>f<Esc>q:<Down><Up><Right><Right><Right>i><BS>?<BS>'|"<BS><BS><BS><><BS><BS>/?<BS><BS>M<<BS><BS>:;<BS><BS>"|'\<BS><BS><BS><BS><Esc>/<Esc><Esc><Right><Left><Right>i-++_<BS><BS><BS><BS>!@#$%^&*()+_)(<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>:?><MM,./;l'\]<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>\\|<BS><BS><Right><Right>|<BS>\<CR>q:<Up><Right><Right><Right><Right>r]lll]}r}<CR>klr}kkA<BS>}<BS>{<Esc>p<Esc>sk<BS><Esc>jllllllrslhrJr(<Up><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>r[]<Esc>wwwwwweeeeehr]<Down><Down><Left><Left><Left>r[<Esc>:c<BS>x<CR>

0 comments


Created by: @sabiddle

350 active golfers, 1143 entries

Leaderboard (lowest score wins):
46
#181 - Jouke-Thiemo Waleson / @jtwaleson

11/08/2012 at 08:29PM

46
#182 - BZ_VG / @BZ_VG

11/13/2012 at 09:22AM

46
#183 - Adam Bell / @adamgbell

03/27/2013 at 01:35AM

46
#184 - Tyler / @tylerbindon

03/31/2013 at 04:37AM

46
#185 - Eric Potter / @pottereric

06/07/2013 at 02:05PM

46
#186 - majo senf / @majo_senf

06/25/2019 at 01:20PM

46
#187 - Алексей Иванин / @AliakseiIvanin

11/10/2021 at 08:58AM

46
#188 - Tyler Carson / @tylerccarson

01/14/2022 at 11:17PM

46
#189 - Jayanth Koushik / @jayanthkoushik

07/10/2024 at 07:23AM

46
#190 - Diwakar Singh Parmar / @parmardiwakar150

08/27/2024 at 01:29PM

47
#191 - Brad Grzesiak / @listrophy

12/28/2010 at 09:47PM

47
#192 - Matthieu Honel / @ocus

01/26/2011 at 08:44AM

47
#193 - Igor Saprykin / @saturdayigor

01/30/2012 at 02:43PM

47
#194 - matthew / @mdespuits

02/02/2012 at 07:45PM

47
#195 - Drew Benedetti / @cnorsl

02/16/2012 at 10:49PM

47
#196 - mwatkward / @AftrschoolSpe

06/25/2012 at 07:55PM

47
#197 - Mikko Loponen / @lopossumi

10/22/2012 at 07:21PM

47
#198 - Lieven Keersmaekers / @LievenKeersmaek

12/02/2012 at 07:23PM

47
#199 - yohe / @yohe_0616

12/23/2012 at 08:35AM

47
#200 - foo / @foo88832727

10/18/2013 at 06:23PM

47
#201 - anonymouse / @anonymo65837183

03/12/2022 at 09:34PM

47
#202 - vuems / @vuems2win

11/26/2022 at 08:21PM

47
#203 - satake0916 / @satake0916

01/21/2024 at 01:33AM

47
#204 - kloir-z / @kloir-z

01/12/2026 at 08:16AM

48
#205 - Shawn Tice / @shtice

12/29/2010 at 12:15AM

48
#206 - Simon Edwardsson / @_SimEdw_

12/29/2010 at 05:23PM

48
#207 - Amir Hedayaty / @hedayaty

12/31/2010 at 02:35PM

48
#208 - Eivind Jahren / @HaskellElephant

01/15/2011 at 11:20PM

48
#209 - Derrick Camerino / @robustdj

04/20/2011 at 11:26PM

48
#210 - Masashi Iizuka / @uochan

04/24/2011 at 07:40AM