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

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 773 remaining solutions by signing in and submitting your own entry
#774 Jon Garmilla / @jon-garmilla-dev - Score: 53 - 10/28/26 @ 17:24
:%s/\v(/<BS>a.*,)(f_<BS>.^<BS>*{<BS>})(\<BS><BS>\)/f=\2;\r1f<BS><BS>\1f)/g<CR>ZZ

0 comments


Created by: @EdgarHipp

774 active golfers, 2430 entries

Leaderboard (lowest score wins):
20
#721 - Sebastien Nicoud / @sebnukem

02/04/2019 at 01:40AM

20
#722 - Michaël Lévesque-Dion / @mlevesquedion

04/25/2019 at 09:42PM

20
#723 - Adi / @adi2004

09/23/2024 at 07:50PM

21
#724 - 郭景維 / @wayne77551

06/01/2014 at 08:38AM

21
#725 - jiangchuan / @tommy_he

11/16/2014 at 07:47PM

21
#726 - Josh Weinstein / @j_weinstein

11/17/2014 at 10:18AM

21
#727 - Vincent Dumoulin / @dumoulinv

11/26/2014 at 02:58AM

21
#728 - air wick / @airwickc

01/23/2015 at 12:30AM

21
#729 - luffy / @raxcoi

06/09/2015 at 10:47AM

21
#730 - Stop and think / @ms_uncountable

07/06/2017 at 12:09PM

21
#731 - churaki / @churaki

01/26/2019 at 04:42AM

21
#732 - Vimfiz / @vimfiz

04/05/2019 at 12:43AM

21
#733 - Rezo Zakala / @rzakala

05/26/2019 at 03:23PM

21
#734 - Marius Ropotica / @cipmar

04/06/2024 at 07:55AM

22
#735 - Jorge Garcia / @slash28cu

05/18/2014 at 10:10AM

22
#736 - Корнев Руслан / @woto7

06/15/2014 at 04:34PM

22
#737 - Max R / @brewtroin

06/22/2014 at 05:58PM

22
#738 - Wandering ponderer / @0proxycon

07/17/2014 at 01:08PM

22
#739 - Simon Mölzer / @h0wser

08/25/2014 at 03:19PM

22
#740 - Glauco Pires / @grpires

11/25/2014 at 12:31AM

22
#741 - Eric Biven / @EricBiven

01/01/2015 at 02:28AM

22
#742 - Dr Rev J. “I am not a bot!” Kirchartz, KSC, KHS / @JKirchartz

01/16/2015 at 04:15AM

22
#743 - uɐɥlnƃ uɐɯɹǝ / @egulhan

03/15/2015 at 07:00PM

22
#744 - Alex Bartol / @alexbartol

05/07/2015 at 08:08PM

22
#745 - Marcus Buffett / @MarcusBuffett

10/05/2015 at 07:00PM

22
#746 - adrien frediani / @fredianiadrien

12/18/2015 at 09:23PM

22
#747 - Kayne West / @portal_narlish

04/25/2016 at 07:43AM

22
#748 - 默罕默德 / @Rt6RjEAJ987Woes

01/22/2019 at 01:34PM

22
#749 - 김형창 / @uVmEMZsCgcYvqZi

04/05/2019 at 09:28AM

23
#750 - Michael Leong / @mhwleong

12/03/2014 at 03:47PM