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

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

315 active golfers, 1015 entries

Solutions by @shahanavazm:
54
#268 - shahanavaz m / @shahanavazm

02/12/2022 at 04:59PM

54
#>268 - shahanavaz m / @shahanavazm

01/17/2024 at 05:31AM

56
#>277 - shahanavaz m / @shahanavazm

01/17/2024 at 04:41AM

57
#>281 - shahanavaz m / @shahanavazm

02/12/2022 at 04:46PM

61
#>285 - shahanavaz m / @shahanavazm

02/12/2022 at 04:57PM

64
#>290 - shahanavaz m / @shahanavazm

02/12/2022 at 04:33PM

68
#>296 - shahanavaz m / @shahanavazm

04/04/2022 at 01:35AM

74
#>301 - shahanavaz m / @shahanavazm

01/17/2024 at 04:36AM

86
#>307 - shahanavaz m / @shahanavazm

01/17/2024 at 04:39AM

97
#>308 - shahanavaz m / @shahanavazm

03/05/2023 at 02:56AM

101
#>308 - shahanavaz m / @shahanavazm

03/05/2023 at 03:14AM