1 Reply Latest reply on Apr 3, 2010 2:53 PM by Zabeth69

    Snippet: multiple occurence of original text?


      I would like to make a snippet that uses the select text twice instead of once.

      For example, an option tag:





      would become


      <option value="optionText"> optionText </option>



      There are actually a number of situations involving js/php that I want this to work for, also.

      Is there a way to do this? Right now I can only put in once instance and always have to type or paste the other.

        • 1. Re: Snippet: multiple occurence of original text?
          Zabeth69 Level 5

          Not sure exactly what you are saying..you do know that you can make a snippet that 'wraps' (puts in a bit before your selection and a bit after your selection)?


          But it sounds as if you want to be able to type in "optionText" once and have it appear in two places, which is trickier.


          Here's a thought: make a snippet that looks like this:

          <option value="


          and wraps, to put at the end:



          type in your optionText, select it and copy it. Then while it is selected, insert the snippet, wrapping the optionText.


          Then paste the optionText from the clipboard, type </ and the rest of option> should fill itself in. Do Edit > Preferences > Code Hints > Close tags after typing </ to set it up.


          I have a suspicion that you may be able to get fancier than this with snippets, but I haven't done so...