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):
44
#121 - CJ Avilla / @wizemanip

05/11/2014 at 12:03AM

45
#122 - Olivier El Mekki / @oelmekki

12/28/2010 at 09:45PM

45
#123 - yossarian / @metaph0x

12/29/2010 at 08:28AM

45
#124 - Balkoth / @_Balkoth_

01/01/2011 at 01:15AM

45
#125 - Rörd Hinrichsen / @roerdhh

01/09/2011 at 11:01PM

45
#126 - Ivan Evtukhovich / @evtuhovich

07/29/2011 at 04:14PM

45
#127 - MONOLITH / @Compulith

01/31/2012 at 08:39AM

45
#128 - Kristopher Urie / @kristopherurie

02/11/2012 at 05:24AM

45
#129 - cj / @cj01101

08/17/2013 at 07:28PM

46
#130 - Henrik Nyh / @henrik

12/31/2010 at 03:30PM

46
#131 - iushdmfsdfn / @iushdmfsdfn

06/10/2011 at 10:36AM

46
#132 - Martin Janiczek / @janiczek

10/16/2011 at 11:48PM

46
#133 - Nolen Royalty / @NolenRoyalty

04/21/2012 at 02:03AM

46
#134 - Jouke-Thiemo Waleson / @jtwaleson

11/08/2012 at 08:29PM

46
#135 - BZ_VG / @BZ_VG

11/13/2012 at 09:22AM

46
#136 - Adam Bell / @adamgbell

03/27/2013 at 01:35AM

46
#137 - Tyler / @tylerbindon

03/31/2013 at 04:37AM

46
#138 - Eric Potter / @pottereric

06/07/2013 at 02:05PM

46
#139 - majo senf / @majo_senf

06/25/2019 at 01:20PM

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

11/10/2021 at 08:58AM

46
#141 - Tyler Carson / @tylerccarson

01/14/2022 at 11:17PM

47
#142 - Brad Grzesiak / @listrophy

12/28/2010 at 09:47PM

47
#143 - Matthieu Honel / @ocus

01/26/2011 at 08:44AM

47
#144 - Igor Saprykin / @saturdayigor

01/30/2012 at 02:43PM

47
#145 - matthew / @mdespuits

02/02/2012 at 07:45PM

47
#146 - Drew Benedetti / @cnorsl

02/16/2012 at 10:49PM

47
#147 - mwatkward / @AftrschoolSpe

06/25/2012 at 07:55PM

47
#148 - Mikko Loponen / @lopossumi

10/22/2012 at 07:21PM

47
#149 - Lieven Keersmaekers / @LievenKeersmaek

12/02/2012 at 07:23PM

47
#150 - yohe / @yohe_0616

12/23/2012 at 08:35AM