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

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

68 active golfers, 166 entries

Solutions by @fzeisler:
51
#8 - Forrest Zeisler / @fzeisler

04/22/2013 at 03:21AM

58
#>19 - Forrest Zeisler / @fzeisler

04/22/2013 at 02:57AM

58
#>19 - Forrest Zeisler / @fzeisler

04/22/2013 at 03:07AM

63
#>25 - Forrest Zeisler / @fzeisler

04/22/2013 at 12:30AM

65
#>28 - Forrest Zeisler / @fzeisler

04/22/2013 at 12:21AM

69
#>38 - Forrest Zeisler / @fzeisler

04/21/2013 at 05:01AM

69
#>38 - Forrest Zeisler / @fzeisler

04/21/2013 at 05:05AM

69
#>38 - Forrest Zeisler / @fzeisler

04/21/2013 at 05:09AM

72
#>46 - Forrest Zeisler / @fzeisler

04/21/2013 at 04:39AM

72
#>46 - Forrest Zeisler / @fzeisler

04/21/2013 at 04:53AM

74
#>47 - Forrest Zeisler / @fzeisler

04/19/2013 at 04:40PM

76
#>52 - Forrest Zeisler / @fzeisler

04/19/2013 at 04:03PM

76
#>52 - Forrest Zeisler / @fzeisler

04/19/2013 at 04:28PM

90
#>61 - Forrest Zeisler / @fzeisler

04/19/2013 at 03:48PM

99
#>63 - Forrest Zeisler / @fzeisler

04/19/2013 at 03:40PM