Created
December 12, 2012 21:19
-
-
Save mattboehm/4271741 to your computer and use it in GitHub Desktop.
Crappy Vim "mail merge"
This file contains hidden or 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
"I recorded a macro of the command. These are the keystrokes I hit to do one line | |
"To do all lines, I recorded the macro in register q (starting on the first line of names.csv) | |
"then did 2@q to repeat macro twice more. | |
"This assumes the template is in the same dir and is very brittle | |
"You should use a templating engine like genshi for non-trivial templating, but just wanted to show that this is possible | |
"Creates $email.html file for each email address. | |
0"ayt,f,l"by$:new^M;read template.html^M:%s;\$EMAIL;^Ra;g^M:s;$NAME;^Rb;g^M:w! ^Ra.html^M:bd^Mj |
This file contains hidden or 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
[email protected] | John Foo | |
---|---|---|
[email protected] | Dave Bar | |
[email protected] | Eric Baz |
This file contains hidden or 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
<html> | |
<body> | |
Hello, <a href="mailto:$EMAIL">$NAME</a>! | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment