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