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 51093f4c6db41b0002000003

Define to require

When JSHint is enabled, there's a rule that doesn't let you have more than 6 arguments in a function, so the moment you need to add a 7th argument, you need to do a refactoring.

Start file
define(
    [
        'jquery',
        'underscore',
        'json',
        'benchmark',
        'coffee',
        'beans',
        'hello'
    ],
    function($, _, json, benchmark, coffee, beans, hello) {
    });
End file
define(function(require) {
    var $ = require('jquery');
    var _ = require('underscore');
    var json = require('json');
    var benchmark = require('benchmark');
    var coffee = require('coffee');
    var beans = require('beans');
    var hello = require('hello');
});

View Diff

1,12c1,9
< define(
<     [
<         'jquery',
<         'underscore',
<         'json',
<         'benchmark',
<         'coffee',
<         'beans',
<         'hello'
<     ],
<     function($, _, json, benchmark, coffee, beans, hello) {
<     });
---
> define(function(require) {
>     var $ = require('jquery');
>     var _ = require('underscore');
>     var json = require('json');
>     var benchmark = require('benchmark');
>     var coffee = require('coffee');
>     var beans = require('beans');
>     var hello = require('hello');
> });

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 36 remaining solutions by signing in and submitting your own entry
#37 Pradeep Kumar / pradeep6kumar - Score: 104 - 01/31/13 @ 14:10
12G04xk.f(di(irequire<Esc>jkkdd2G.8GA,<Esc>:9mt<BS>1<CR>i<BS><Esc>:%s/\v\s*'(.+)'.*/    var \1 = require('\1');<CR>2Gwcw$<Esc>j.r_ZZ

0 comments

#38 Oliver Christ / 0liverChrist - Score: 109 - 11/23/13 @ 21:51
Afu<C-P>(require) {<Esc>jddi$<Down><Left>_<Esc>+qqlywhP+q4@q2dd<<2Gqqi<BS><BS><BS><BS>var <Esc>f'i = re<C-P>(<Esc>f';a)<Esc>lr;+q.@q@q@q@q@q@qa;<0xe2><0x80><0xa2>G<BS><BS><Esc>3Gf;r_ZZ

0 comments

#39 RR Arnold III / rra3 - Score: 110 - 05/27/13 @ 23:24
:11<CR>daw:1<CR>A<Esc>pa(require) {<Esc>jdd:9<CR>dddd04x:s<BS>$<BS>%s/\v\s*'(.+)'.*/    var \1`<BS> = require('\1');<CR>:2<CR>fjdiwi$<Esc>jciw_<Esc>ZZ

0 comments

#40 Aeden Jameson / daliful - Score: 113 - 02/09/13 @ 23:33
JCuu<Esc>uuuuuuuJuJCfunction(require) {<Esc>8GA,<Esc>j2dd<<:%s    <BS><BS><BS><BS>/    '\(.*\)',/var \1 = require('\t<BS>1');<CR>2Gwcw$<Esc>jcw_<Esc>ZZ

0 comments

#41 Ravi S Sinha / ambidextrousTx - Score: 119 - 07/22/13 @ 02:05
Afunction(require) {<Esc>jdd7J<<jddf(yi)O<Esc>Pjdd<<kA,<Esc>kA,<Esc>j0qadt,kO<Esc>PIvar <Esc>A = require();<Esc>I    <Esc>j0dt,kf(pj0xxj..q6@ak<Esc>dd.:wq<CR>

0 comments

#42 Amy / imightbeAmy - Score: 150 - 02/15/13 @ 20:22
jdd9Gjkddy$0gg$PupBci)require<Esc>9G0df(f)d$:s/,/<BS> /;<BS>\r<CR>:<Up>/g<CR>V<Esc><C-V>6k$d2GP9Gd15G<<<Esc>k<Down><Down>lkV2G:s/ //g<CR>A,<Esc>qq0iv<BS>    var <Esc>ea = require(<Esc>$s);<Esc>kq6@qjF'F'd<Right>f(a'<Esc>:x<CR>

0 comments

#43 Ryo Sakikawa / ryosakikawa - Score: 159 - 02/16/13 @ 20:19
<NL>dd10GVkd<Esc>1G$afunction(require) {<Esc>j^<C-V>8GIvar $ = require(<Esc>2j3welll<C-V>jjjj$y3bhpelvlehhdjelxr jvhbdjhvelehhdjvelhhhd<Esc>4Gel<C-V>jjjjld<Esc>klr_<Esc>kV7G:s/,/);<CR>j$a);<Esc>jbh<C-V>2G0d<Esc>ZZ

0 comments

#44 Niil Öhlin / Niil94 - Score: 188 - 03/03/13 @ 20:45
jdd9G.d$gg$p9Gddd02Gqa4Xivar = require(<C-C><C-C>ER);<C-C><C-C>jBq6$3G6@akfoa'<C-C><C-C>77ggggf(,,l,,lf(ldWdWjBTri $<C-C><C-C>ji_ <C-C><C-C>qbgg16ldWq4Gea <C-C><C-C>phxx@b5Gea <C-C><C-C>pXx@b6Gea <C-C><C-C>pXx<C-C><C-C>@b7Gea <C-C><C-C>pxXggfhc<Esc>de8Gea <C-C><C-C>pfryeggt)p:wq<CR>

0 comments

#45 くま55 / kumack55 - Score: 259 - 04/11/13 @ 04:44
:11<CR>df($x:s/ \([^ ]*\)[,)]/\r\tvar \1 =require(/g<CR><C-V>&$kkkkkkx:3<CR>hh<C-V>6jpullh<C-V>jjjjjjp<C-V>jjuuuuuu<C-R><C-R>jjkl<C-V>6j$xkkkkkkkkkkkjjPupupupu<C-V>jjjjjPllllllllllllllllllllllhhhhhhhhhhhhhhhhhhhhhhhhhhhh:s<BS>%s/ *'/'<CR>gg$afunction(r<C-P>) {<Esc>jdd:%s/,/);<CR>:%s/=/= /<CR>J2xj8Dh<C-V>hhhhggjd<C-V>jjjjjjypZZ

0 comments

#46 jonlorusso / jonlorusso - Score: 291 - 04/26/13 @ 21:27
:set paste<CR>vGCdefine(function(require) {<CR>    var $ = require('jquery');<CR>    var _ = require('underscore');<CR>    var json = require('json');<CR>    var benchmark = require('benchmark');<CR>    var coffee = require('coffee');<CR>    var beans = require('beans');<CR>    var hello = require('hello');<CR>});<Esc>ZZ

0 comments

Created by: blingcoder

46 active golfers, 113 entries

Leaderboard (lowest score wins):
62
#1 - Urtica dioica / udioica

01/30/2013 at 11:56PM

62
#2 - Victor Ramirez / virako

02/02/2013 at 01:45AM

62
#3 - Andrew Hlavats / farthestworld

03/21/2013 at 10:00PM

62
#4 - Chase Stubblefield / sterlingchase

04/27/2013 at 08:34AM

62
#5 - Petro Тrouq / zulolosi

07/04/2013 at 08:59PM

62
#6 - Bradd Szonye / bszonye

07/14/2013 at 10:35AM

62
#7 - Ingo / ist3fani

07/29/2013 at 05:46PM

62
#8 - John Braxler / braxler

05/30/2014 at 06:51PM

63
#9 - Vito / GodFather

02/25/2013 at 06:07AM

65
#10 - Marco Hinz / _mhinz_

01/30/2013 at 11:17PM

65
#11 - wushexu / wushexu

05/29/2013 at 10:43AM

67
#12 - zealotrush / zealotrush

01/31/2013 at 06:54AM

69
#13 - Asmund Liseth / Asmund_L

01/31/2013 at 09:22PM

69
#14 - Jon Krause / jkrause314

12/11/2015 at 09:38PM

75
#15 - Trevor Powell / DoomedBunnies

02/05/2013 at 06:21AM

75
#16 - Daniel Lundin / danielundin

02/13/2013 at 03:44PM

75
#17 - Ram Tamtam / ramtamtamtam

07/07/2014 at 04:03PM

77
#18 - Pawel Obrok / mrYapee

01/30/2013 at 10:44PM

78
#19 - Øystein Walle / oysteinwalle

01/30/2013 at 10:19PM

78
#20 - Steve Tjoa / stevetjoa

01/31/2013 at 02:56AM

78
#21 - cj / cj01101

08/20/2013 at 05:14PM

79
#22 - Yann Moisan / YannMoisan

01/31/2013 at 10:28PM

81
#23 - Forrest Zeisler / fzeisler

04/28/2013 at 03:04PM

82
#24 - Kai Yuan / kentyuan

02/23/2013 at 02:12AM

82
#25 - 전영식 / garam111

02/28/2013 at 07:40AM

85
#26 - sfoo / sfoo

02/24/2013 at 12:16AM

87
#27 - Andrew Burgess / andrew8088

03/09/2013 at 06:37PM

88
#28 - Ben Zittlau / benzittlau

04/26/2013 at 08:26PM

89
#29 - Christopher Harrison / Xophmeister

01/30/2013 at 04:45PM

89
#30 - Runar / runarfu

01/30/2013 at 06:53PM

90
#31 - Will / w_labranche

08/30/2016 at 02:42AM

92
#32 - Corey Glynn / albedoa

04/08/2013 at 03:37PM

98
#33 - Cristian Lupașcu / clupasq

02/27/2016 at 12:52PM

99
#34 - DOUG BLACK / dougblackio

04/08/2013 at 05:05AM

101
#35 - John Dalton / johndalton

04/27/2013 at 02:08PM

102
#36 - Mauro Persano / fzort

05/24/2015 at 04:22PM

104
#37 - Pradeep Kumar / pradeep6kumar

01/31/2013 at 02:10PM

109
#38 - Oliver Christ / 0liverChrist

11/23/2013 at 09:51PM

110
#39 - RR Arnold III / rra3

05/27/2013 at 11:24PM

113
#40 - Aeden Jameson / daliful

02/09/2013 at 11:33PM

119
#41 - Ravi S Sinha / ambidextrousTx

07/22/2013 at 02:05AM

150
#42 - Amy / imightbeAmy

02/15/2013 at 08:22PM

159
#43 - Ryo Sakikawa / ryosakikawa

02/16/2013 at 08:19PM

188
#44 - Niil Öhlin / Niil94

03/03/2013 at 08:45PM

259
#45 - くま55 / kumack55

04/11/2013 at 04:44AM

291
#46 - jonlorusso / jonlorusso

04/26/2013 at 09:27PM