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):
47
#151 - iantalks / @iantalks

05/11/2013 at 06:58PM

47
#152 - foo / @foo88832727

10/18/2013 at 06:23PM

47
#153 - anonymouse / @anonymo65837183

03/12/2022 at 09:34PM

48
#154 - Shawn Tice / @shtice

12/29/2010 at 12:15AM

48
#155 - Simon Edwardsson / @_SimEdw_

12/29/2010 at 05:23PM

48
#156 - Amir Hedayaty / @hedayaty

12/31/2010 at 02:35PM

48
#157 - Eivind Jahren / @HaskellElephant

01/15/2011 at 11:20PM

48
#158 - Derrick Camerino / @robustdj

04/20/2011 at 11:26PM

48
#159 - Masashi Iizuka / @uochan

04/24/2011 at 07:40AM

48
#160 - Daniel Stoza / @dstoza

08/29/2011 at 02:32AM

48
#161 - sjatkinson / @sjatkinson

08/29/2011 at 07:49PM

48
#162 - Simon Scarfe / @simonscarfe

08/30/2011 at 03:13PM

48
#163 - jasper110 / @jasper110

09/21/2011 at 05:19PM

48
#164 - Jon Keating / @emostar

11/02/2011 at 06:20AM

48
#165 - vimja / @vimja666

11/04/2011 at 11:25PM

48
#166 - Daniel Cohen / @danielissimo

02/08/2012 at 04:16PM

48
#167 - ise0615 / @ise0615

05/04/2012 at 05:01PM

48
#168 - Kevin McGladdery / @run_kmc

08/12/2012 at 08:35PM

48
#169 - うえっち / @uh_tomo

12/04/2012 at 04:44PM

48
#170 - Sheng / @shenghis

08/26/2013 at 06:32AM

49
#171 - Matt Garrett / @matthewgarrett

12/28/2010 at 10:18PM

49
#172 - Rune Botten / @runeb

12/31/2010 at 03:10PM

49
#173 - Francisco Dibar / @frandibar

01/11/2011 at 05:08AM

49
#174 - Pete Johns / @johnsyweb

01/15/2011 at 02:42AM

49
#175 - Thomas Schönwälder / @Masei1988

01/15/2011 at 08:03PM

49
#176 - Solomon White / @rubysolo

02/08/2011 at 05:09PM

49
#177 - Emile Swarts / @EmileSwarts

05/30/2011 at 10:10AM

49
#178 - demon.mhm / @demonmhm

02/28/2012 at 09:12PM

49
#179 - Timothy Caraballo / @openback

02/22/2013 at 07:24PM

49
#180 - Martin Sander / @0x89

03/08/2013 at 02:04PM