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 @Tsimon-Dorakh:

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

306 active golfers, 957 entries

Solutions by @Tsimon-Dorakh:
34
#38 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:56PM

35
#>47 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:55PM

36
#>50 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:52PM

37
#>63 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:51PM

38
#>73 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:49PM

39
#>79 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:46PM

40
#>91 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:44PM

41
#>108 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:42PM

42
#>122 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:40PM

43
#>134 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:30PM

44
#>145 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:27PM

45
#>155 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:21PM

52
#>249 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:19PM

56
#>269 - Tsimon Dorakh / @Tsimon-Dorakh

07/31/2024 at 08:06PM