[TxMt] Changing cursor position from command

Juan juanfc at lcc.uma.es
Tue Feb 13 20:13:56 UTC 2007


> With the following command, TextMate will put the semicolons in the
> desired place, but the cursor doesn't move, which is annoying.
>
> input: selected text or line
> output: replace selected text
> activation: key equivalent ';'
> scope: "source"
>
> #!/usr/bin/env ruby
>
> $t = STDIN.read
>
> if $t =~ /\A(.*)\;\Z/
>  $c = ENV['TM_LINE_INDEX'].to_i
>  print $t.insert($c, ';')
> else
>  print $t+';'
> end
>
> Any idea how to move the cursor? Snippets handle cursor motion, but
> I'm not sure I can get the semicolon to go to the right spot. Ideas?
> Tricks?


	Nop.  It should be great to have an API to access TM interface from  
the scripts, shouldn't be?

;)




More information about the textmate mailing list