[TxMt] Env vars

Juan Falgueras jfalgueras at uma.es
Mon Sep 3 08:51:56 UTC 2007


	Hi

asking for help

I have the next code for to eat the spaces behind the cursor (with  
Shift and FwdDel).  My problem is I know only how to move around the  
current line but not how to go beyond and eat also new lines in order  
to reach the start of the next line.

	#!/usr/bin/env ruby

	sel = ENV['TM_SELECTED_TEXT']
	if sel != nil
	  sel = sel.dup
	  sel.gsub!(/\s/, '')
	  print sel
	  exit 0
	end

	left  = ENV['TM_CURRENT_LINE'][0, ENV['TM_LINE_INDEX'].to_i]
	right = ENV['TM_CURRENT_LINE'][ENV['TM_LINE_INDEX'].to_i .. -1]

	right.gsub!(/^\s+/, '')

	print left + right

I have found the env vars

	TM_CURRENT_LINE'
	TM_LINE_INDEX
	TM_LINE_NUMBER
	TM_INPUT_START_LINE

but it is not evident for me how to know the whole text before/after  
the cursor.

Any idea will be welcome.






More information about the textmate mailing list