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

315 active golfers, 1015 entries

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

07/31/2024 at 08:56PM

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

07/31/2024 at 08:55PM

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

07/31/2024 at 08:52PM

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

07/31/2024 at 08:51PM

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

07/31/2024 at 08:49PM

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

07/31/2024 at 08:46PM

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

07/31/2024 at 08:44PM

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

07/31/2024 at 08:42PM

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

07/31/2024 at 08:40PM

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

07/31/2024 at 08:30PM

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

07/31/2024 at 08:27PM

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

07/31/2024 at 08:21PM

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

07/31/2024 at 08:19PM

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

07/31/2024 at 08:06PM