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):
35
#31 - Jean George / @JeanGeo20504212

03/21/2022 at 09:19PM

36
#32 - oliver mueller / @marcontwit

01/22/2012 at 08:08AM

36
#33 - Sofia Balicka / @so_phifi

03/20/2013 at 09:57AM

37
#34 - Ravil Bayramgalin / @brainopia

01/02/2011 at 04:57PM

37
#35 - Wei Dai / @clvv42

01/03/2011 at 02:04AM

37
#36 - Tim Dean / @Tmdean

01/05/2011 at 07:16PM

37
#37 - Ruy Diaz / @diazruy

03/11/2011 at 04:43AM

37
#38 - Terje Larsen / @terlars

05/12/2011 at 11:46AM

37
#39 - Pei-Lun Lee / @ypcatw

01/14/2012 at 04:00AM

37
#40 - Henry Johnes / @xeosvn

01/31/2012 at 01:05PM

37
#41 - Kerson Hsiao / @KersonHsiao

08/03/2012 at 03:12AM

37
#42 - Marcin Szamotulski / @me_coot

09/26/2012 at 08:27AM

37
#43 - David Barnett / @mu_mind

11/26/2012 at 10:30AM

37
#44 - igoodrich / @igoodrich

03/04/2013 at 06:49AM

37
#45 - Dimitar Dimitrov / @kurkale6ka

04/13/2016 at 01:17PM

37
#46 - Qing Liu / @poeminlash

06/29/2022 at 04:57AM

38
#47 - Justin Love / @wondible

06/08/2011 at 03:04PM

38
#48 - Lauri Tirkkonen / @lotheac

07/01/2011 at 10:43PM

38
#49 - Emeric Dupont / @stucule

08/23/2011 at 01:04PM

38
#50 - Jesús Espino / @jespinog

09/06/2011 at 08:31AM

38
#51 - You-Siang Lin / @yslinnctu

11/27/2011 at 05:08AM

38
#52 - Trevor Powell / @DoomedBunnies

11/29/2011 at 12:24AM

38
#53 - Zeh Rizzatti / @zehrizzatti

02/06/2012 at 01:46AM

38
#54 - M8R eonxi21 / @eonxi21

05/20/2013 at 08:19PM

38
#55 - jakeroberts / @jakeroberts

05/29/2017 at 02:37PM

38
#56 - DHM / @DHM29978992

04/30/2018 at 07:55PM

39
#57 - rabidpraxis / @rabidpraxis

01/22/2011 at 03:31AM

39
#58 - Xavier Nayrac / @lkdjiin

12/29/2011 at 01:58PM

39
#59 - drupalovereasy / @drupalovereasy

04/15/2012 at 02:12AM

39
#60 - Dom Armstrong / @dom_cycleface

09/12/2013 at 12:33PM