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

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

68 active golfers, 166 entries

Solutions by @DoubleFelix_:
52
#11 - Felix / @DoubleFelix_

02/24/2015 at 10:14AM

56
#>15 - Felix / @DoubleFelix_

02/24/2015 at 10:13AM

59
#>24 - Felix / @DoubleFelix_

02/24/2015 at 10:10AM

65
#>29 - Felix / @DoubleFelix_

02/24/2015 at 10:08AM

68
#>36 - Felix / @DoubleFelix_

02/24/2015 at 10:04AM

72
#>47 - Felix / @DoubleFelix_

02/24/2015 at 10:01AM

76
#>53 - Felix / @DoubleFelix_

02/24/2015 at 09:57AM