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

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

293 active golfers, 924 entries

Solutions by @ShannonGu1031:
34
#37 - shannon / @ShannonGu1031

05/28/2024 at 06:15AM

34
#>37 - shannon / @ShannonGu1031

05/28/2024 at 06:16AM

34
#>37 - shannon / @ShannonGu1031

05/28/2024 at 06:19AM

34
#>37 - shannon / @ShannonGu1031

05/31/2024 at 03:54PM

35
#>46 - shannon / @ShannonGu1031

05/28/2024 at 06:12AM

36
#>48 - shannon / @ShannonGu1031

05/27/2024 at 06:52AM

36
#>48 - shannon / @ShannonGu1031

05/28/2024 at 02:39AM

36
#>48 - shannon / @ShannonGu1031

05/28/2024 at 03:10AM

36
#>48 - shannon / @ShannonGu1031

05/28/2024 at 04:01AM

37
#>61 - shannon / @ShannonGu1031

05/27/2024 at 06:51AM

37
#>61 - shannon / @ShannonGu1031

05/31/2024 at 03:50PM

38
#>71 - shannon / @ShannonGu1031

05/27/2024 at 06:49AM

39
#>77 - shannon / @ShannonGu1031

05/27/2024 at 06:48AM

40
#>89 - shannon / @ShannonGu1031

05/27/2024 at 06:46AM

41
#>106 - shannon / @ShannonGu1031

05/27/2024 at 06:45AM

42
#>120 - shannon / @ShannonGu1031

05/27/2024 at 06:36AM

47
#>178 - shannon / @ShannonGu1031

05/27/2024 at 02:39AM

48
#>197 - shannon / @ShannonGu1031

05/27/2024 at 06:27AM

51
#>234 - shannon / @ShannonGu1031

05/26/2024 at 01:09PM

52
#>241 - shannon / @ShannonGu1031

05/26/2024 at 02:29PM

61
#>267 - shannon / @ShannonGu1031

05/26/2024 at 01:04PM