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 252 remaining solutions by signing in and submitting your own entry
#253 Ed Gibbs / @edward_gibbs - Score: 188 - 08/15/11 @ 05:15
wwwwr(wwwwr)wr[wwwwr[wwwwwwwwwwww<Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Up><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>r]wwr(wwwwww<Left><Left>r)wr{wwwwwww<Right>r(wwwwwww<Right>r)wwwwwwr}<Up><Up><Up><Up><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>r{<Down><Down><Down><Down><Down><Down><Down><Down><Left>r}<Esc>:w<CR>:q<CR>

0 comments


Created by: @sabiddle

253 active golfers, 710 entries

Leaderboard (lowest score wins):
40
#61 - wyl rof / @wylrof

01/11/2011 at 04:03PM

40
#62 - Clive Evans / @swish_bob

01/13/2011 at 08:26PM

40
#63 - Sergey Doroshenko / @dorserg

03/04/2011 at 09:48AM

40
#64 - William Dunand / @wdunand

12/13/2011 at 01:21AM

40
#65 - Ali Moeeny MD PhD / @alimoeeny

12/14/2011 at 08:16PM

40
#66 - Tara Bass / @tara_bass

12/31/2011 at 11:44PM

40
#67 - 無ん垢の叫び / @john_ababa

02/22/2012 at 01:06PM

40
#68 - OMF / @exolon

05/28/2012 at 12:51AM

40
#69 - RobertT / @techrt2050

07/30/2013 at 10:42PM

40
#70 - brett / @brettyukich

09/22/2013 at 09:21AM

40
#71 - Daniel Marjenburgh / @dmarjenburgh

11/17/2013 at 12:03PM

40
#72 - Gurukandhamoorthi / @Gurukandhamoor1

07/22/2017 at 03:59PM

41
#73 - uuu / @uu59

12/29/2010 at 08:16PM

41
#74 - Ilya Strukov / @i1ey

05/01/2011 at 05:40PM

41
#75 - kjrn / @kjrnleto

05/22/2011 at 07:10PM

41
#76 - mightyfoo / @mightyfoo

05/25/2011 at 12:58PM

41
#77 - Adam Ransom / @voidgmr

12/23/2011 at 02:51PM

41
#78 - Peter Anselmo / @peter_anselmo

03/13/2012 at 01:32PM

41
#79 - vansan / @VinceVansan

08/21/2012 at 11:05AM

41
#80 - tmr / @tmr314

09/07/2012 at 12:23PM

41
#81 - Hubba / @HubbaBubbaFett

11/21/2012 at 09:00PM

41
#82 - Phillip David / @phrodod

12/22/2012 at 07:40AM

41
#83 - Sebastian Morr / @blinry

01/17/2013 at 11:32PM

41
#84 - Steve Tjoa / @stevetjoa

01/30/2013 at 07:41AM

41
#85 - Charlene Tshos / @charlymul

05/24/2013 at 06:23AM

41
#86 - Quota / @Quotad

02/10/2014 at 04:08PM

41
#87 - Joonas Pihlajamaa / @jokkebk

02/19/2014 at 03:21PM

41
#88 - Данил / @Danilkirienko81

06/29/2022 at 08:50AM

42
#89 - Steve Morrow / @yawmark

12/31/2010 at 09:07PM

42
#90 - Tim Chase / @gumnos

01/08/2011 at 03:40PM