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

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

325 active golfers, 1056 entries

Solutions by @chrisatanasian:
34
#32 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:08PM

35
#>51 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:05PM

36
#>55 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:04PM

37
#>68 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:04PM

38
#>80 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:03PM

39
#>85 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:02PM

40
#>99 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:01PM

42
#>130 - Chris Atanasian / @chrisatanasian

11/17/2023 at 09:00PM

43
#>144 - Chris Atanasian / @chrisatanasian

11/17/2023 at 08:59PM

44
#>156 - Chris Atanasian / @chrisatanasian

11/17/2023 at 08:58PM

50
#>239 - Chris Atanasian / @chrisatanasian

11/17/2023 at 08:55PM

52
#>261 - Chris Atanasian / @chrisatanasian

11/17/2023 at 08:54PM

53
#>265 - Chris Atanasian / @chrisatanasian

11/17/2023 at 08:52PM