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

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

314 active golfers, 1014 entries

Solutions by @yancy_dong:
34
#24 - yancy / @yancy_dong

04/29/2022 at 06:32AM

35
#>47 - yancy / @yancy_dong

04/29/2022 at 06:31AM

36
#>52 - yancy / @yancy_dong

04/29/2022 at 06:29AM

37
#>65 - yancy / @yancy_dong

04/29/2022 at 06:29AM

38
#>77 - yancy / @yancy_dong

04/29/2022 at 06:28AM

39
#>81 - yancy / @yancy_dong

04/29/2022 at 06:27AM

40
#>96 - yancy / @yancy_dong

04/29/2022 at 06:26AM

41
#>111 - yancy / @yancy_dong

04/29/2022 at 06:25AM

42
#>124 - yancy / @yancy_dong

04/29/2022 at 06:24AM

43
#>139 - yancy / @yancy_dong

04/29/2022 at 06:22AM

50
#>234 - yancy / @yancy_dong

04/29/2022 at 06:19AM