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

Changing URL path in CSS

What's the quickest way to swap out all the URLs in a CSS file? Is it wasted keystrokes using look-behinds and look-aheads? (I'm sorry for the delete/report--I made a mistake with the last one requiring an ugly search for graphic to replace with images. I just intended this to be a simple search and replace that might possibly generate some macros or normals solutions that are quicker)

Start file
body {
	background: #d47300 url(graphics/noise.png);	
	font-family: 'Open Sans', sans-serif;
}


.background {
	background: url(../images/background_shadow.png) no-repeat top center;
	background-position: 50% 16%;	
}

.background_overlay {
	background: url(../images/background_overlay.png) no-repeat top center;
	padding: 0;
	margin:0;
}


.order {
	background: #ff9e00 url(graphics/order.png) repeat-x;
	height: 25px;
	display: inline-block;
	color: #d47300;
	line-height: 25px;
	font-weight: 700;
	font-size: 13px;
	font-weight: 800;
	padding: 0 10px;
	-webkit-border-radius: 20px;
	-moz-border-radius: 20px;
	box-shadow: 0 0 0px 5px rgba(0,0,0,0.10);	
	margin-right: 20px;
	text-transform: uppercase;
	color: #825600;
	text-shadow: 0px 1px 0px rgba(255,255,255,0.50);
}

.sponsor:hover {
	background-position: 0px -25px;
}

.sponsor:active {
	background: #ff9e00 url(../images/sponsors/sponsorBlock.png) repeat-x;
	background-position: 0px -50px;
}


.telephone {
	background: #fff url(graphics/telephone.png) repeat-x;
	height: 25px;
	display: inline-block;
	color: #A65A01;
	line-height: 25px;
	font-weight: 700;
	font-size: 14px;
	padding: 0 10px;
	-webkit-border-radius: 20px;
	-moz-border-radius: 20px;
	box-shadow: 0 0 0px 5px rgba(0,0,0,0.10);	
	margin-right: 20px;
	text-shadow: 0px 1px 0px rgba(255,255,255,0.50);
}


.social {
	background: #fff url(../social/telephone.png) repeat-x;
	display: inline-block;
	height: 25px;
	line-height: 25px;
	padding: 0 10px;
	color: #A65A01;
	font-weight: 700;
	font-size: 14px;
	-webkit-border-radius: 20px;
	-moz-border-radius: 20px;
	box-shadow: 0 0 0px 5px rgba(0,0,0,0.10);	
	margin-right: 20px;
}
End file
body {
	background: #d47300 url(/wp-content/themes/black/graphics/noise.png);	
	font-family: 'Open Sans', sans-serif;
}


.background {
	background: url(/wp-content/themes/black/images/background_shadow.png) no-repeat top center;
	background-position: 50% 16%;	
}

.background_overlay {
	background: url(/wp-content/themes/black/images/background_overlay.png) no-repeat top center;
	padding: 0;
	margin:0;
}


.order {
	background: #ff9e00 url(/wp-content/themes/black/graphics/order.png) repeat-x;
	height: 25px;
	display: inline-block;
	color: #d47300;
	line-height: 25px;
	font-weight: 700;
	font-size: 13px;
	font-weight: 800;
	padding: 0 10px;
	-webkit-border-radius: 20px;
	-moz-border-radius: 20px;
	box-shadow: 0 0 0px 5px rgba(0,0,0,0.10);	
	margin-right: 20px;
	text-transform: uppercase;
	color: #825600;
	text-shadow: 0px 1px 0px rgba(255,255,255,0.50);
}

.sponsor:hover {
	background-position: 0px -25px;
}

.sponsor:active {
	background: #ff9e00 url(/wp-content/themes/black/images/sponsors/sponsorBlock.png) repeat-x;
	background-position: 0px -50px;
}


.telephone {
	background: #fff url(/wp-content/themes/black/graphics/telephone.png) repeat-x;
	height: 25px;
	display: inline-block;
	color: #A65A01;
	line-height: 25px;
	font-weight: 700;
	font-size: 14px;
	padding: 0 10px;
	-webkit-border-radius: 20px;
	-moz-border-radius: 20px;
	box-shadow: 0 0 0px 5px rgba(0,0,0,0.10);	
	margin-right: 20px;
	text-shadow: 0px 1px 0px rgba(255,255,255,0.50);
}


.social {
	background: #fff url(/wp-content/themes/black/social/telephone.png) repeat-x;
	display: inline-block;
	height: 25px;
	line-height: 25px;
	padding: 0 10px;
	color: #A65A01;
	font-weight: 700;
	font-size: 14px;
	-webkit-border-radius: 20px;
	-moz-border-radius: 20px;
	box-shadow: 0 0 0px 5px rgba(0,0,0,0.10);	
	margin-right: 20px;
}

View Diff

2c2
< 	background: #d47300 url(graphics/noise.png);	
---
> 	background: #d47300 url(/wp-content/themes/black/graphics/noise.png);	
8c8
< 	background: url(../images/background_shadow.png) no-repeat top center;
---
> 	background: url(/wp-content/themes/black/images/background_shadow.png) no-repeat top center;
13c13
< 	background: url(../images/background_overlay.png) no-repeat top center;
---
> 	background: url(/wp-content/themes/black/images/background_overlay.png) no-repeat top center;
20c20
< 	background: #ff9e00 url(graphics/order.png) repeat-x;
---
> 	background: #ff9e00 url(/wp-content/themes/black/graphics/order.png) repeat-x;
43c43
< 	background: #ff9e00 url(../images/sponsors/sponsorBlock.png) repeat-x;
---
> 	background: #ff9e00 url(/wp-content/themes/black/images/sponsors/sponsorBlock.png) repeat-x;
49c49
< 	background: #fff url(graphics/telephone.png) repeat-x;
---
> 	background: #fff url(/wp-content/themes/black/graphics/telephone.png) repeat-x;
66c66
< 	background: #fff url(../social/telephone.png) repeat-x;
---
> 	background: #fff url(/wp-content/themes/black/social/telephone.png) repeat-x;

Solutions by @shahanavazm:

Unlock 1 remaining solutions by signing in and submitting your own entry
Created by: @Salshammath

62 active golfers, 138 entries

Solutions by @shahanavazm:
57
#53 - shahanavaz m / @shahanavazm

03/21/2024 at 05:08PM