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):
49
#181 - Kuldeep Bora / @kuldeep_bora

04/18/2013 at 05:18PM

49
#182 - James / @Dronak

09/03/2013 at 11:34PM

49
#183 - Walker Boh / @walker_boh

11/04/2015 at 08:48AM

49
#184 - Jurica / @Jurica34581259

12/06/2018 at 04:03AM

50
#185 - Cap / @cappy_haddock

12/29/2010 at 09:48AM

50
#186 - Roman Mašek / @romario333

01/04/2011 at 07:15AM

50
#187 - dave lyons / @loadedfingers

01/05/2011 at 10:32AM

50
#188 - Joost / @vlabakje

02/12/2011 at 12:10PM

50
#189 - Jam / @jam00_bcn

06/19/2011 at 01:59PM

50
#190 - Neil / @spameldoon

08/21/2011 at 12:57AM

50
#191 - nicolas bo / @thevegeta

11/09/2011 at 08:13AM

50
#192 - teocx / @teocx

07/15/2012 at 09:44AM

50
#193 - Josh Johnson / @jnjosh

04/07/2013 at 03:27AM

50
#194 - Tyler Tesch / @TylerTesch

06/02/2013 at 05:04PM

50
#195 - Chenut Ludovic / @7Brwa7

03/30/2016 at 08:28PM

51
#196 - Andrey Tarantsov / @andreyvit

12/28/2010 at 10:10PM

51
#197 - Andrey A. Ugolnik / @andreyugolnik

01/19/2011 at 06:15PM

51
#198 - Thom Hughes / @thom_hughes_1

03/23/2011 at 02:43PM

51
#199 - drooooooooooo / @droooooooooooo

08/08/2011 at 02:19AM

51
#200 - Eric Weikl / @ericweikl

03/08/2013 at 02:14PM

51
#201 - Simon Tost / @Someone_Busy

03/08/2013 at 03:12PM

51
#202 - David Fonseca / @ddfonseca6

10/09/2016 at 12:56AM

51
#203 - Sean Cahill / @ess_jay_kay

11/01/2021 at 02:37PM

52
#204 - Rob Ciaccio / @RobertoCalavera

01/16/2011 at 08:47AM

52
#205 - Craig H. Anderson / @CootCraig

04/18/2011 at 03:41PM

52
#206 - Mikhail Korepanov / @PanyaKor

06/13/2011 at 01:33PM

52
#207 - mnx / @mnxx

06/04/2012 at 09:59PM

52
#208 - Dave Ingram / @dmi

11/21/2012 at 06:31PM

52
#209 - くま ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้้้้ 55 / @kumack55

04/03/2013 at 12:07PM

52
#210 - RockerZZY / @rocker_zzy

06/25/2020 at 02:05AM