SuperSub : Enhanced Substitute Command
script karma |
Rating 5/2,
Downloaded by 923 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Phil Miller |
|
script type |
utility |
|
description |
SuperSub is an enhanced substitute command that can both replace multiple words in one line as well as multiple words in multiple lines.
Here are some examples:
My first name is Phil, my last name is Miller
Sure you could probably feed a simple regex into the standard substitute command for this one but you'll get the point
Issuing :S/Phil/John/Miller/Smith will change it to
My first name is John, my last name is Smith
Ok, so that's not very exciting so check out this. Let's say you have this piece of PHP code:
$contacts[1] = "Phil"
Simple right? Now you want five of them.
So you copy it five times:
$contacts[1] = "Phil"
$contacts[1] = "Phil"
$contacts[1] = "Phil"
$contacts[1] = "Phil"
$contacts[1] = "Phil"
Then you select all but the first row and issue this command:
:S/1/;2;3;4;5/Phil/;Jessica;Joel;Kaitlyn;PorkChop
And out comes this:
$contacts[1] = "Phil"
$contacts[2] = "Jessica"
$contacts[3] = "Joel"
$contacts[4] = "Phil"
$contacts[5] = "PorkChop" |
|
install details |
Just drop supersub.vim in your plugin directory. |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.97.14.83
|