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 by @paulsmolloy:

Unlock 13 remaining solutions by signing in and submitting your own entry
Created by: @sabiddle

315 active golfers, 1015 entries

Solutions by @paulsmolloy:
34
#31 - Paul Molloy / @paulsmolloy

10/20/2023 at 05:45PM

35
#>48 - Paul Molloy / @paulsmolloy

10/20/2023 at 05:03PM

35
#>48 - Paul Molloy / @paulsmolloy

10/20/2023 at 05:06PM

36
#>52 - Paul Molloy / @paulsmolloy

10/20/2023 at 04:57PM

37
#>65 - Paul Molloy / @paulsmolloy

10/20/2023 at 04:47PM

38
#>77 - Paul Molloy / @paulsmolloy

10/20/2023 at 04:44PM

39
#>82 - Paul Molloy / @paulsmolloy

10/20/2023 at 04:41PM

42
#>126 - Paul Molloy / @paulsmolloy

10/20/2023 at 04:36PM

43
#>140 - Paul Molloy / @paulsmolloy

10/20/2023 at 04:08PM

56
#>277 - Paul Molloy / @paulsmolloy

10/20/2023 at 03:36PM

56
#>277 - Paul Molloy / @paulsmolloy

10/20/2023 at 03:41PM

60
#>284 - Paul Molloy / @paulsmolloy

10/20/2023 at 03:33PM

61
#>285 - Paul Molloy / @paulsmolloy

10/20/2023 at 03:29PM