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 511991607729fb0002000003

Refactor arguments into object argument

A relatively common Javascript refactoring.

Start file
function foo(hello, world,
             how, are,
             you) {
}
End file
function foo(parameters) {
    var hello = parameters.hello;
    var world = parameters.world;
    var how = parameters.how;
    var are = parameters.are;
    var you = parameters.you;
}

View Diff

1,3c1,6
< function foo(hello, world,
<              how, are,
<              you) {
---
> function foo(parameters) {
>     var hello = parameters.hello;
>     var world = parameters.world;
>     var how = parameters.how;
>     var are = parameters.are;
>     var you = parameters.you;

Solutions by @dice_tea:

Unlock 10 remaining solutions by signing in and submitting your own entry
Created by: @blingcoder

65 active golfers, 161 entries

Solutions by @dice_tea:
58
#18 - Joel Elkins / @dice_tea

03/04/2013 at 12:10AM

59
#>20 - Joel Elkins / @dice_tea

03/04/2013 at 12:01AM

61
#>24 - Joel Elkins / @dice_tea

03/04/2013 at 12:00AM

63
#>24 - Joel Elkins / @dice_tea

03/03/2013 at 11:50PM

67
#>30 - Joel Elkins / @dice_tea

03/03/2013 at 11:48PM

70
#>38 - Joel Elkins / @dice_tea

03/03/2013 at 11:35PM

77
#>51 - Joel Elkins / @dice_tea

03/01/2013 at 04:46PM

80
#>55 - Joel Elkins / @dice_tea

03/01/2013 at 04:41PM

92
#>59 - Joel Elkins / @dice_tea

03/01/2013 at 03:42PM

121
#>61 - Joel Elkins / @dice_tea

03/01/2013 at 03:39PM