[TxMt] smart typing - can it be smarter or type less? :)
Scott Barron
scott at elitists.net
Sun Dec 4 23:39:25 UTC 2005
On Dec 4, 2005, at 9:12 AM, Paul Bissex wrote:
> On 12/3/05, porneL <textmate at pornel.net> wrote:
>>
>> I generally like smart typing feature, but it gets in the way
>> sometimes.
>>
>> For example if I want to add parens around expression, I often just
>> get ()
>> before it (if expression starts with ! or $).
>
> For this, you can select the expression and then just type a left
> paren.
>
>> It's horror when I need to change double quotes to single quotes. I
>> end up
>> having something like: "'""'"
>>
>> Is it possible to configure it to work only when there is
>> whitespace/EOL
>> ahead of cursor? Or to disable it for cases I mentioned above?
>> I don't want to disable it completly and I don't want to add symbols
>> to
>> word characters list.
>
> This one bites me fairly often, and unlike the parens doesn't have an
> easy workaround that I'm aware of. I like the idea of having Smart
> Typing being more selective when it comes to quotation marks.
>
> Other ideas or workarounds, anyone?
>
> pb
Maybe a command called 'toggle quotes' that operates on the selected
text and does something like:
#!/usr/bin/env ruby
print ENV['TM_SELECTED_TEXT'].gsub(/('|")(.*)('|")/) { |z| $1 == '"' ?
"'#{$2}'" : "\"#{$2}\"" }
Just a quick hack, I haven't checked if anything in particular breaks
it.
--
Scott Barron
Lunchbox Software
http://lunchboxsoftware.com
http://lunchroom.lunchboxsoftware.com
http://rubyi.st
More information about the textmate
mailing list