[TxMt] Re: End of screen
nigel at greenlemur.com
Sun Jan 18 18:28:27 UTC 2009
Hans posted a message about this in the week:
For that purpose I have a simple helper tmcommand "saveMe":
- Bundle Editor > New Command
- Save: Current File
- Input: None
- Output: Discard
* Command: is really empty!
Set up your command and this "saveMe" command, then start recording a
macro and run "saveMe", then run your command (use the "cog" menu at
the bottom of the TextMate window to access and run the commands
rather than any key combos you have them saved to). Save the macro,
then when you run it the file will be saved before your commands are
processed, which should mean 'wc -l' always returns a correct value.
Hope that helps!
On 18 Jan 2009, at 15:26, Andrea Crotti wrote:
> Nigel Green wrote:
>> Looks good - maybe you need to wrap this around a macro that saves
>> 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?
> Of course I will.
> I tried to register a macro as you said but it wasn't successful..
> It just made this
> beforeRunningCommand = nop;
> command = "tot=$(wc -l $TM_FILEPATH)\ntot=$(echo $tot | cut -d '
> ' -f
> 1)\n# echo $tot, $TM_LINE_NUMBER\nif [ $tot == $((TM_LINE_NUMBER -
> 1)) ]\n
> # we are at the end of the file\nthen\n \truby -e 'puts \"\\n
> input = selection;
> name = center;
> output = afterSelectedText;
> scope = source;
> uuid = "29DCBC0A-6C1F-4C0A-A640-767E6A412394";
> I don't quite understand where all the macro magic comes from, and
> why there
> almost no documentation about, and how should I know for example what
> "selectHardLine" does.
> Where it looks it doesn't say anything about saving file, in fact it
> Moving the caret back to the center it's not so easy apparently, any
> View this message in context: http://www.nabble.com/End-of-screen-tp21319865p21528935.html
> Sent from the textmate users mailing list archive at Nabble.com.
> textmate mailing list
> textmate at lists.macromates.com
More information about the textmate