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):
89
#31 - Christopher Harrison / @Xophmeister

01/30/2013 at 04:45PM

89
#32 - Runar / @runarfu

01/30/2013 at 06:53PM

90
#33 - Will / @obiwan__k3n00bi

08/30/2016 at 02:42AM

92
#34 - Corey Glynn / @albedoa

04/08/2013 at 03:37PM

98
#35 - Cristian Lupașcu / @clupasq

02/27/2016 at 12:52PM

99
#36 - DOUG BLACK / @dougblackio

04/08/2013 at 05:05AM

101
#37 - John Dalton / @johndalton

04/27/2013 at 02:08PM

102
#38 - Mauro Persano / @fzort

05/24/2015 at 04:22PM

104
#39 - Pradeep Kumar 🇮🇳🇮🇳🇮🇳🇮🇱🇮🇱🇮🇱 / @pradeep6kumar

01/31/2013 at 02:10PM

104
#40 - Matt Tuttle / @Matt_Tuttle

06/02/2020 at 05:39AM

109
#41 - Oliver Christ / @0liverChrist

11/23/2013 at 09:51PM

110
#42 - RR Arnold III / @rra3

05/27/2013 at 11:24PM

110
#43 - nickGPT / @nickandbro

08/28/2024 at 06:49PM

113
#44 - Aeden Jameson / @daliful

02/09/2013 at 11:33PM

119
#45 - Ravi S Sinha / @ambidextrousTx

07/22/2013 at 02:05AM

150
#46 - Amy / @imightbeAmy

02/15/2013 at 08:22PM

159
#47 - Ryo Sakikawa / @ryosakikawa

02/16/2013 at 08:19PM

188
#48 - Niil Öhlin / @Niil94

03/03/2013 at 08:45PM

259
#49 - くま ก็็็็็็็็็็็็็ʕ•͡ᴥ•ʔ ก้้้้้้้้้้้ 55 / @kumack55

04/11/2013 at 04:44AM

291
#50 - jonlorusso / @jonlorusso

04/26/2013 at 09:27PM