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 49 remaining solutions by signing in and submitting your own entry
#50 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

50 active golfers, 127 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 - Chasetopher / @chasetopherlee

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

62
#9 - Peppa Pig / @PeppaPi95550250

07/03/2024 at 05:56AM

63
#10 - Vito / @GodFather

02/25/2013 at 06:07AM

65
#11 - Marco Hinz / @_mhinz_

01/30/2013 at 11:17PM

65
#12 - 张文远 / @zhwenyuan

05/29/2013 at 10:43AM

67
#13 - zealotrush / @zealotrush

01/31/2013 at 06:54AM

69
#14 - Asmund / @herrasbe

01/31/2013 at 09:22PM

69
#15 - Jon Krause / @jkrause314

12/11/2015 at 09:38PM

75
#16 - Trevor Powell / @DoomedBunnies

02/05/2013 at 06:21AM

75
#17 - Daniel Lundin / @danielundin

02/13/2013 at 03:44PM

75
#18 - Ram Tamtam / @ramtamtamtam

07/07/2014 at 04:03PM

77
#19 - Pawel Obrok / @mrYapee

01/30/2013 at 10:44PM

78
#20 - Øystein Walle / @oysteinwalle

01/30/2013 at 10:19PM

78
#21 - Steve Tjoa / @stevetjoa

01/31/2013 at 02:56AM

78
#22 - cj / @cj01101

08/20/2013 at 05:14PM

78
#23 - RockerZZY / @rocker_zzy

05/31/2020 at 02:08PM

79
#24 - Yann Moisan / @YannMoisan

01/31/2013 at 10:28PM

81
#25 - Forrest Zeisler / @fzeisler

04/28/2013 at 03:04PM

82
#26 - Kai Yuan / @kentyuan

02/23/2013 at 02:12AM

82
#27 - 전영식 / @garam111

02/28/2013 at 07:40AM

85
#28 - sfoo / @sfoo

02/24/2013 at 12:16AM

87
#29 - Andrew Burgess / @andrew8088

03/09/2013 at 06:37PM

88
#30 - Ben Zittlau / @benzittlau

04/26/2013 at 08:26PM