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)