[TxMt] Select pasted text
Thomas Aylott (subtleGradient)
oblivious at subtlegradient.com
Sat Feb 24 17:28:16 UTC 2007
On Feb 24, 2007, at 11:40 AM, Gerd Knops wrote:
> On Feb 24, 2007, at 9:48 AM, Nigel Chapman wrote:
>
>> I often find that I paste something into a document, then
>> immediately select it to do something to it, like wrapping it in
>> tags or converting characters to entities. Long ago I used an
>> editor (possibly alpha) that had a 'select pasted text' command,
>> that did the selection straight after a paste, without having to
>> drag over it or whatever. I can't find an equivalent command in
>> TextMate, nor any environment variables pointing to the start and
>> end of the latest pasting that would let me implement it myself.
>>
>> Have I missed something? Either a command in some bundle I don't
>> know about or some other way of achieving the same effect?
>>
>> If not, here's a feature request. Any one of the following:
>>
>> Select Pasted Text command
>> Paste and Select command (extra modifier key on cmd-V)
>> Select after Pasting preference.
>>
>> Thanks for any help or pointers.
>>
> Easy:
>
> <Paste & Select.tmCommand>
That one breaks if you paste anything with certain reserved characters.
If you have the r 6636 version of the TextMate escape library…
You can use this one instead.
http://pastie.textmate.org/42665
#!/usr/bin/env ruby
require ENV['TM_SUPPORT_PATH'] + "/lib/escape.rb"
print "${0:#{e_snp(`pbpaste`)}}"
If you don't have the latest version of the escape library, you'll
have to add
http://pastie.textmate.org/42666
# escape text for use in a TextMate snippet placeholder
def e_snp(str)
str.to_s.gsub(/(?=[$`\\}])/, '\\')
end
thomas Aylott — subtleGradient — CrazyEgg — sixteenColors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070224/23f0f4bb/attachment.html>
More information about the textmate
mailing list