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

175 active golfers, 436 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

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

04/23/2011 at 08:21AM

20
#67 - Julien Pivotto / @roidelapluie

04/23/2011 at 04:48PM

20
#68 - Terje Larsen / @terlars

05/09/2011 at 12:01PM

20
#69 - carlpeter / @carlpeter1

11/15/2011 at 11:07AM

20
#70 - Martin Aumueller / @aumuell

05/04/2012 at 08:22PM

20
#71 - brett / @brettyukich

09/24/2013 at 09:49AM

20
#72 - sockdude1 / @sockdude1

11/11/2013 at 09:44PM

20
#73 - Clark DuVall / @theclarkatron

05/23/2015 at 05:28AM

20
#74 - Jon Krause / @jkrause314

04/16/2016 at 10:15PM

20
#75 - Chester Yap / @Chest_ErYap

08/11/2019 at 11:35PM

20
#76 - mevmev / @mevmev8

08/25/2021 at 11:27AM

20
#77 - rappenstein2 / @rappenstein2

01/30/2022 at 08:12PM

20
#78 - blabla zincou / @BZincou

03/21/2022 at 09:15PM

21
#79 - Shawn / @sartak

04/22/2011 at 10:39PM

21
#80 - Cam Thompson / @camthompson

04/29/2011 at 12:32AM

21
#81 - Tim Dean / @Tmdean

05/03/2011 at 06:11AM

21
#82 - Will Gray / @graywh

05/06/2011 at 07:57PM

21
#83 - Mohammed / @mbadran

05/10/2011 at 02:05PM

21
#84 - Jean-Rene David / @jeanrenedavid

05/12/2011 at 01:16AM

21
#85 - tdirrenb / @tdirrenb

05/16/2011 at 02:33AM

21
#86 - Yannis Chatzimichos / @feedward

06/02/2011 at 03:09AM

21
#87 - Kent Sibilev / @datanoise

06/30/2011 at 05:25AM

21
#88 - Torben Rasmussen / @rasmustorben

08/15/2011 at 05:37PM

21
#89 - Dühöngő / @aswna

09/02/2011 at 06:38PM

21
#90 - Jon Allured / @jonallured

09/14/2011 at 01:35AM