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):
21
#91 - Christopher Erin / @MCNormalMode

09/21/2011 at 08:39PM

21
#92 - Andy Pincombe / @ampersandy

10/29/2011 at 10:29AM

21
#93 - Dave Harrington / @ozzy_dave

11/06/2011 at 12:18AM

21
#94 - 415fox / @415fox

11/08/2011 at 06:36PM

21
#95 - Arton0306 / @Arton0306

12/18/2011 at 05:05PM

21
#96 - Rik Lomas / @riklomas

12/30/2011 at 12:27AM

21
#97 - Kurt Gaastra / @KGaastra

02/13/2012 at 02:37AM

21
#98 - Alexander Scherbinin / @realmyst

02/14/2012 at 12:37AM

21
#99 - 無ん垢の叫び / @john_ababa

02/27/2012 at 12:31PM

21
#100 - Golf Sinteppadon / @minigolf2000

04/27/2012 at 10:49PM

21
#101 - Nolen Royalty / @NolenRoyalty

05/15/2012 at 07:23PM

21
#102 - Fernando Ortiz / @fortiz2k

06/17/2012 at 07:29AM

21
#103 - Javier Cervantes / @solojavier

08/31/2012 at 09:10PM

21
#104 - James / @Dronak

09/05/2013 at 02:43PM

21
#105 - Joonas Pihlajamaa / @jokkebk

02/21/2014 at 08:29AM

21
#106 - Carlos Hernando / @chernando

04/26/2014 at 06:56PM

21
#107 - Connie Qi / @connieqi

06/11/2014 at 04:43PM

21
#108 - Tom / @BureaucratGr11

06/30/2015 at 07:52PM

21
#109 - Daniel / @Daniel00288663

04/05/2017 at 09:45AM

21
#110 - POSIX / @po6ix

01/30/2022 at 07:19AM

22
#111 - Thom Hughes / @thom_hughes_1

05/04/2011 at 05:34AM

22
#112 - t__naka / @t__naka

08/12/2011 at 07:42AM

22
#113 - こばばー / @symmet

09/07/2011 at 08:04AM

22
#114 - Matt Woelk / @MattWoelk

11/12/2011 at 12:21AM

22
#115 - strager / @strager

12/12/2011 at 02:45AM

22
#116 - bmamax / @bmamax

01/17/2012 at 03:08PM

22
#117 - Steven Sloss / @StevenSloss

02/19/2012 at 06:28PM

22
#118 - Paul Patience / @talmodighet

02/23/2012 at 07:03AM

22
#119 - arno renevier / @dadadiblog

03/19/2012 at 07:26AM

22
#120 - Nick Harding / @nick_harding

08/28/2013 at 08:31PM