[TxMt] Re: End of screen

Nigel Green nigel at greenlemur.com
Sat Jan 17 10:23:17 UTC 2009


Looks good - maybe you need to wrap this around a macro that saves the  
file before it runs. I am guessing that 'wc -l' gives a wrong result  
if its run when the file has been altered but not saved? Best to  
create a macro that sinply saves the file, then a new macro which  
calls the save macro, then runs the code.

I had a similar problem with the caret moving when I tried to set up a  
macro to fix common typos using sed on save. If you find out how to  
reposition the cursor to where it was when the macro is run, can you  
let me know?

Thanks,

Nigel


On 16 Jan 2009, at 21:53, Andrea Crotti wrote:

>
> I tried to code something to solve this, it's not elegant at all and  
> it
> doesn't always work but it's a start
>
> tot=$(wc -l $TM_FILEPATH)
> tot=$(echo $tot | cut -d ' ' -f 1)
> echo $tot, $TM_LINE_NUMBER
> if [ $tot == $((TM_LINE_NUMBER - 1)) ]
>  # we are at the end of the file
> then
> 	ruby -e 'puts "\n"*30'
> fi
>
> If appears that we are at the end of the file it print 30
> newlines.
> The problems are:
> - sometimes (wc -l) executed in this way gives me a wrong
> result (don't understand why)
> - the caret goes to the last line
>
> When this will be solved for me it will be fine...
> Maybe would be better to use macros?
> -- 
> View this message in context: http://www.nabble.com/End-of-screen-tp21319865p21509237.html
> Sent from the textmate users mailing list archive at Nabble.com.
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate




More information about the textmate mailing list