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

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

316 active golfers, 1018 entries

Solutions by @bounce114:
34
#42 - bounce114 / @bounce114

12/01/2024 at 06:10AM

35
#>50 - bounce114 / @bounce114

12/01/2024 at 06:08AM

36
#>53 - bounce114 / @bounce114

12/01/2024 at 05:50AM

37
#>67 - bounce114 / @bounce114

12/01/2024 at 05:46AM

38
#>77 - bounce114 / @bounce114

12/01/2024 at 05:43AM

39
#>84 - bounce114 / @bounce114

12/01/2024 at 05:34AM

39
#>84 - bounce114 / @bounce114

12/01/2024 at 05:42AM

40
#>96 - bounce114 / @bounce114

12/01/2024 at 05:32AM

40
#>96 - bounce114 / @bounce114

12/01/2024 at 05:37AM

40
#>96 - bounce114 / @bounce114

12/01/2024 at 05:38AM

41
#>113 - bounce114 / @bounce114

12/01/2024 at 05:24AM

41
#>113 - bounce114 / @bounce114

12/01/2024 at 05:28AM

44
#>152 - bounce114 / @bounce114

12/01/2024 at 05:20AM

47
#>188 - bounce114 / @bounce114

12/01/2024 at 05:19AM

48
#>207 - bounce114 / @bounce114

12/01/2024 at 05:13AM

50
#>237 - bounce114 / @bounce114

12/01/2024 at 05:08AM

52
#>256 - bounce114 / @bounce114

12/01/2024 at 05:02AM

54
#>270 - bounce114 / @bounce114

12/01/2024 at 04:59AM

54
#>270 - bounce114 / @bounce114

12/01/2024 at 05:23AM