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 536cfa23fcccd100025678bd

Extract argument from function

The aim is to see if you can do some refactoring very fast.

Start file
attr("y",function(v){return v})
End file
f=function(v){return v};
attr("y",f)

View Diff

1c1,2
< attr("y",function(v){return v})
---
> f=function(v){return v};
> attr("y",f)

Solutions by @MelvinCheung:

Unlock 9 remaining solutions by signing in and submitting your own entry
Created by: @EdgarHipp

729 active golfers, 2218 entries

Solutions by @MelvinCheung:
13
#186 - Melvin Cheung / @MelvinCheung

05/25/2017 at 05:52PM

13
#>240 - Melvin Cheung / @MelvinCheung

11/09/2019 at 03:58PM

14
#>338 - Melvin Cheung / @MelvinCheung

05/25/2017 at 05:51PM

15
#>443 - Melvin Cheung / @MelvinCheung

05/25/2017 at 05:50PM

16
#>517 - Melvin Cheung / @MelvinCheung

05/25/2017 at 05:49PM

16
#>527 - Melvin Cheung / @MelvinCheung

11/09/2019 at 03:56PM

17
#>608 - Melvin Cheung / @MelvinCheung

05/25/2017 at 05:48PM

17
#>614 - Melvin Cheung / @MelvinCheung

11/09/2019 at 03:54PM

28
#>727 - Melvin Cheung / @MelvinCheung

05/25/2017 at 05:48PM