[TxMt] modifying Wrap Selection as Link

Joe Maller joe at joemaller.com
Sat Jun 10 03:52:58 UTC 2006


When invoked without a selection, the HTML Wrap Selection as Link  
snippet doesn't select the placeholder display text. Adding a second  
tab stop to the command could select the placeholder display text but  
would add an extra tab for those accustomed to using the snippet with  
a selection.

Two questions:

1. is this a worthwhile change (or am I just looking for problems  
where none really exist)?
2. Is there a way to make the second tab-stop conditional on whether  
any text was selected?


Possible modification (added tab stop to the last line):

         <a href="${1:`
            # if the clipboard contains a single line, let’s use that
            if [[ $(pbpaste|wc -l) -eq 0 ]]
               then pbpaste|sed 's/&/&/g'
               else echo http://site.com/
            fi
         `}">${2:${TM_SELECTED_TEXT:Link text...}}</a>


The current last line is:

         `}">${TM_SELECTED_TEXT:Link text...}</a>





More information about the textmate mailing list