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 4db0b1c8e8eb0f564b00001c

Case preserving word replacement

Half way through my project, my people turned into dogs. Now I have to change everything in my source.

Start file
function Human() {

}

Human.prototype = {
        humanStuff
: function(){},
        doHumanStuff
: function() {
                useDigitalWatch
();
       
}
}
End file
function Dog() {

}

Dog.prototype = {
        dogStuff
: function(){},
        doDogStuff
: function() {
                useDigitalWatch
();
       
}
}

View Diff

1c1
< function Human() {
---
> function Dog() {
5,7c5,7
< Human.prototype = {
<       humanStuff: function(){},
<       doHumanStuff: function() {
---
> Dog.prototype = {
>       dogStuff: function(){},
>       doDogStuff: function() {
10a11
>

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 179 remaining solutions by signing in and submitting your own entry
#180 Jacob Rosenblatt / @JKRosenblatt - Score: 71 - 06/15/14 @ 16:02
:%s/[Hu<BS>human<Left><Left><Left><Left>]<Right><Right><Right><Right>/\=submatch(0) ==# 'human' ? 'dog' : 'Dog'/g<CR>:wq<CR>

0 comments


Created by: @captain_morgan

180 active golfers, 454 entries

Leaderboard (lowest score wins):
19
#61 - Lory / @Lory46845742

12/25/2019 at 03:18PM

19
#62 - roudens / @roudens2

03/01/2021 at 12:15AM

19
#63 - Scott Atkins / @scottrick49

08/04/2021 at 01:12PM

19
#64 - Miłosz Łakomy / @foobar01123

09/29/2021 at 10:49AM

19
#65 - Jean George / @JeanGeo20504212

05/18/2022 at 05:48PM

19
#66 - Janzen / @__Coos

09/22/2022 at 01:44PM

19
#67 - Omar Alawadhi / @OmarAla59544225

10/17/2022 at 10:54PM

19
#68 - Peppa Pig / @PeppaPigSg

07/03/2024 at 08:15AM

20
#69 - h_east (トロッコ6個) / @h_east

04/23/2011 at 08:21AM

20
#70 - Julien Pivotto / @roidelapluie

04/23/2011 at 04:48PM

20
#71 - Terje Larsen / @terlars

05/09/2011 at 12:01PM

20
#72 - carlpeter / @carlpeter1

11/15/2011 at 11:07AM

20
#73 - Martin Aumueller / @aumuell

05/04/2012 at 08:22PM

20
#74 - brett / @brettyukich

09/24/2013 at 09:49AM

20
#75 - sockdude1 / @sockdude1

11/11/2013 at 09:44PM

20
#76 - Clark DuVall / @theclarkatron

05/23/2015 at 05:28AM

20
#77 - Jon Krause / @jkrause314

04/16/2016 at 10:15PM

20
#78 - Chester Yap / @Chest_ErYap

08/11/2019 at 11:35PM

20
#79 - mevmev / @mevmev8

08/25/2021 at 11:27AM

20
#80 - rappenstein2 / @rappenstein2

01/30/2022 at 08:12PM

20
#81 - blabla zincou / @BZincou

03/21/2022 at 09:15PM

20
#82 - かみひろ / @km_hr

03/16/2024 at 02:45PM

21
#83 - Shawn / @sartak

04/22/2011 at 10:39PM

21
#84 - Cam Thompson / @camthompson

04/29/2011 at 12:32AM

21
#85 - Tim Dean / @Tmdean

05/03/2011 at 06:11AM

21
#86 - Will Gray / @graywh

05/06/2011 at 07:57PM

21
#87 - Mohammed / @mbadran

05/10/2011 at 02:05PM

21
#88 - Jean-Rene David / @jeanrenedavid

05/12/2011 at 01:16AM

21
#89 - tdirrenb / @tdirrenb

05/16/2011 at 02:33AM

21
#90 - Yannis Chatzimichos / @feedward

06/02/2011 at 03:09AM