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

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

68 active golfers, 166 entries

Solutions by @zulolosi:
48
#2 - Petro Тrouq / @zulolosi

02/17/2013 at 08:28AM

66
#>30 - Petro Тrouq / @zulolosi

02/17/2013 at 08:22AM

74
#>47 - Petro Тrouq / @zulolosi

02/12/2013 at 11:00PM

79
#>56 - Petro Тrouq / @zulolosi

02/12/2013 at 10:32PM

82
#>57 - Petro Тrouq / @zulolosi

02/12/2013 at 10:56PM