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 @foobar01123:

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

253 active golfers, 710 entries

Solutions by @foobar01123:
34
#22 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:35AM

35
#>30 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:34AM

36
#>33 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:32AM

37
#>45 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:30AM

38
#>56 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:29AM

45
#>129 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:26AM

49
#>184 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:24AM

59
#>230 - Miłosz Łakomy / @foobar01123

02/15/2020 at 04:20AM