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):
53
#211 - Dave / @zzdave13

08/02/2011 at 08:16PM

53
#212 - Daniel Harrington / @rubiii

12/10/2011 at 07:42PM

53
#213 - Bernhard Tausch / @tauschb

03/08/2013 at 02:13PM

54
#214 - alex scott / @4l3xsc0tt

12/30/2010 at 02:41AM

54
#215 - jacobangel / @jacobangel

12/31/2010 at 08:15AM

54
#216 - Dezső Zoltán / @zakiazigazi

01/22/2011 at 07:24AM

54
#217 - TchiKong / @tchikong

01/29/2011 at 01:06PM

54
#218 - Gowtham Madhava / @gowthamgowtham

07/02/2012 at 04:52PM

54
#219 - Manuel Meilinger / @MMeilinger

03/08/2013 at 02:25PM

54
#220 - shahanavaz m / @shahanavazm

02/12/2022 at 04:59PM

55
#221 - Fred Nias / @frednias

12/30/2010 at 11:37AM

55
#222 - Adelar S. Queiróz / @adelarsq

11/25/2012 at 01:26AM

55
#223 - René Scheibe / @renescheibe

03/08/2013 at 02:16PM

56
#224 - drio / @drio

12/29/2010 at 03:35PM

56
#225 - Son of Bongo / @bpcode

08/26/2012 at 03:32AM

56
#226 - Rob Grijs / @robgrijs

10/14/2012 at 04:00PM

57
#227 - clint tseng / @cxlt

12/28/2010 at 09:28PM

57
#228 - Axl Waii / @axlwaii

08/26/2012 at 12:58PM

57
#229 - Milind Ganjoo / @mganjoo

01/25/2014 at 10:29PM

57
#230 - vimgolfer / @vimgolfer7

10/04/2019 at 05:00AM

60
#231 - Brandon Ferguson / @bnferguson

12/31/2010 at 10:26PM

60
#232 - Matt York / @yorkmatt

02/13/2012 at 06:54PM

62
#233 - Sean Wolfe / @swolfe

12/28/2010 at 10:09PM

62
#234 - wesrog / @wesrog

12/28/2010 at 10:20PM

62
#235 - Thibault Jouan / @tjouan

12/29/2010 at 10:34PM

63
#236 - Suhas V / @vhasus

04/15/2013 at 12:01PM

65
#237 - changling / @Lspacewalker

12/19/2011 at 07:45PM

65
#238 - Global Maquereau / @GlobalMaquereau

12/31/2012 at 10:54AM

66
#239 - Henri Bourcereau / @mmai

12/30/2010 at 01:36PM

67
#240 - Chris Parsons / @chrismdp

12/28/2010 at 10:49PM