[TxMt] Re: Smart Home Key

Simon Strandgaard neoneye at gmail.com
Sun Dec 7 17:32:17 UTC 2008


On Sun, Dec 7, 2008 at 5:52 PM, Hans-Jörg Bibiko <bibiko at eva.mpg.de> wrote:
>
> On 07.12.2008, at 13:30, Simon Strandgaard wrote:
[snip]
>> This looks promising. I have tried it out, but it behaves a bit odd.
>> When I first tried experimenting with it your snippet jumps to the
>> start of the document. Then I began writing this reply and wanted
>> to double check.. and I inserted your snippet again, but now it
>> does nothing.
>
> First it is not a snippet in TM terms. It must be a command.

Yes I have made it as a command.



> Then, what's odd?
>
> The command checks if your cursor is at the beginning of a line:
> TM_COULUMN_NUMBER==1?
> If so it moves the cursor to the beginning of the doc. If not it moves the
> cursor to first column of the current line.
>
>> if its possible to go to an X,Y position
>> without modifying the document..
>
> This is done by using 'open txmt://open?line=X&column=Y'. This command tells
> TM to activate the front most doc and set the cursor to X,Y without
> modifying the doc.

I guessed that, but I should probably used other words for it :-)


Whenever I run the command TM places the caret on line 2 column 1.
I have recorded a video of the problem, however its impossible to see
what going on.
I make changes to the X and Y values in this command a few times, but the
caret doesn't change.
http://vimeo.com/2454977

I have made a ruby script out of it, in hope of turning it into a
Smart Home command.

#! /usr/bin/ruby
cmd = "open 'txmt://open?line=5&column=10'"
system cmd

Example, if I set X to 13 and Y to 20.. then TM jumps to line 2, column 1.


Nevermind. Your command jumps to the beginning of the line, and second
time I hit
Home it jumps to the beginning of the document. I have tried modifying
your command to jump to column=5, but TM jumps to column 1.

if [ $TM_COLUMN_NUMBER -eq 1 ]; then
	open "txmt://open?line=1" &
else
	open "txmt://open?line=$TM_LINE_NUMBER&column=5" &
fi


And changing it so it jumps to line 3.. has no effect too.

if [ $TM_COLUMN_NUMBER -eq 1 ]; then
	open "txmt://open?line=3" &
else
	open "txmt://open?line=$TM_LINE_NUMBER&column=1" &
fi


Nevermind, I don't think we come closer to the Smart Home behavior.

-- 
Simon Strandgaard
my graphics program for mac - http://toolboxapp.com/


More information about the textmate mailing list