Home Download Buy Blog Forum Support

Video Tip: Creating n copies of a template with varying data

Video Tip: Creating n copies of a template with varying data

Postby Phrogz on Thu Feb 21, 2013 7:25 pm

I've found myself repeatedly with a multi-line template that I need multiple copies of, but I need to customize each template with one or more values specific to that template. This has happened both in XML as well as real code.

Instead of copy/pasting the template n times and then filling out each copy, here's a video tip showing how I accomplish this goal in Sublime:

Roughly explained:
  1. Create one line for each of the custom data that will go into each template copy.
  2. Copy the template onto the clipboard.
  3. Create one selection region at the start of each custom data line.
  4. Paste. This creates one multi-line template copy for each bit of custom data interleaved with your data, leaving you with multiple selection regions.
  5. Cut your custom data and then move into the template and paste and edit as appropriate.

If your custom data uses different number of characters, the key to using this to good effect is to use home/end after moving to a new line to ensure that you're in a consistent location, and then use ctrl+arrow keys to move by words instead of characters.
Posts: 18
Joined: Tue Mar 02, 2010 4:21 pm

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 27 guests