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):
42
#91 - Andrey Ivanov / @Bytamine

01/19/2011 at 05:01PM

42
#92 - Wesley Wong / @wesleymwwong

01/29/2011 at 08:37AM

42
#93 - icdark / @icdark

05/29/2011 at 11:05PM

42
#94 - Jason Then / @racc69

08/08/2011 at 04:22AM

42
#95 - Dave Bradford / @dbradf

10/12/2011 at 05:58PM

42
#96 - David Pflug / @dpflug

05/17/2012 at 10:04PM

42
#97 - ineb / @ineb0

08/22/2012 at 11:52AM

42
#98 - Daniel / @Daniel00288663

04/03/2017 at 09:40AM

42
#99 - Zach Lapidus / @zach_lapidus

05/25/2021 at 01:34AM

43
#100 - Mike Plotz / @antisuji

12/30/2010 at 03:01AM

43
#101 - fukamikaze / @fukamikaze

01/01/2011 at 05:00AM

43
#102 - David Lam / @lamdk

01/02/2011 at 09:45AM

43
#103 - xhtmlforum / @xhtmlforum

01/31/2011 at 08:15PM

43
#104 - Mike Marion / @mikejmarion

03/21/2011 at 08:21AM

43
#105 - dtennant / @dtennant

06/24/2011 at 04:18PM

43
#106 - Jon Olin / @8BitTree

01/03/2012 at 06:33AM

43
#107 - Tom Sisk / @TomSisk

07/05/2012 at 08:13PM

43
#108 - Darcy Parker / @DarcyParker

10/16/2012 at 04:15PM

43
#109 - Liam Thurston / @lthurston188

08/18/2015 at 06:37AM

43
#110 - Jakob / @jajob

01/09/2017 at 07:36AM

44
#111 - kana / @kana1

12/29/2010 at 07:09PM

44
#112 - Behnam Esfahbod / @zwnj

12/31/2010 at 01:51PM

44
#113 - Jarkko Laine / @jarkko

01/02/2011 at 09:47AM

44
#114 - Fer Enaf / @0x00C0FFEE

01/05/2011 at 10:42AM

44
#115 - Tom Duijf / @tomduijf

02/12/2011 at 12:12PM

44
#116 - Alex Croteau-Pothier / @AlexCP_

02/06/2012 at 08:15PM

44
#117 - Aaron Lake / @aaronmlake

02/28/2012 at 07:29PM

44
#118 - Nick Miller / @ItsMeNickMiller

08/21/2012 at 05:39PM

44
#119 - Kenneth Waters / @gen_witt

11/13/2012 at 07:49PM

44
#120 - Dmytro Dzhulgakov / @dzhulgakov

04/28/2013 at 08:56PM