[TxMt] Re: smart home

Constantinos Neophytou ♎ jaguarcy at gmail.com
Tue Apr 10 10:20:37 UTC 2007


On Apr 9, 2007, at 10:35 PM, Simon Strandgaard wrote:

> [snip]
>
> Ah, nice.
>
> I have modified it slightly so that it first jump's to the the
> text-beginning and afterwards to the line-beginning.
>
>
> #! /usr/bin/ruby
> line   = ENV['TM_CURRENT_LINE']
> index  = ENV['TM_LINE_INDEX'].to_i
>
> # extract leading whitespace
> remain = line.sub(/(^[ \t]*)/, '')
> whitespace = $1
>
> if index == whitespace.size
>  whitespace = ''
> else
>  line = remain
> end
>
> # place cursor
> print "#{whitespace}${1}#{line}"
>

Excellent... one issue though, it seems that it trims some of the  
line with it on certain cases. I use smarty templates in some of my  
work, and some lines have text like:

	{$var|modifier}

after using the command, $var disappears (everything before the pipe,  
not including the left curly brace)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1288 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070410/7e21ce85/attachment.p7s>


More information about the textmate mailing list