Created
September 21, 2012 16:45
-
-
Save ethanmuller/3762565 to your computer and use it in GitHub Desktop.
Vimnastics: Writing Repetitive Markup in Vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<option value="100">$100</option> | |
<option value="200">$200</option> | |
<option value="300">$300</option> | |
<!-- and so on... --> | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<option value="100">$100</option> | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim normal mode commands | |
qa # start recording our macro in the “a” register | |
yy # yank the current line | |
p # paste the yanked line | |
/\d<return> # search for the next digit (1 in this case) | |
100<ctrl-A> # increment 100 times | |
n # repeat the last search (\d) | |
100<ctrl-A> # increment 100 times* | |
q # stop recording our macro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<option value="100">$100</option> | |
<option value="200">$200</option> | |
<option value="300">$300</option> | |
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<option value="100">$100</option> | |
<option value="200">$200</option> | |
<option value="300">$300</option> | |
<option value="400">$400</option> | |
<option value="500">$500</option> | |
<option value="600">$600</option> | |
<option value="700">$700</option> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment