[TxMt] Re: Restore caret after macro?

Allan Odgaard mailinglist at textmate.org
Tue May 19 10:32:06 UTC 2015


On 17 May 2015, at 11:52, Robert Milton wrote:

> I have a number of macros which move the caret. They would be nicer if 
> they put it back where they found it. Is there a neat way of getting a 
> macro to put the caret and/or selection back where it found it? 
> Failing that, is there an ugly one?

If you have an existing macro you can locate it in the bundle editor. 
Here you see an array of commands, insert this as the first command:

	{ command = 'setMark:'; },

And then as the last command add:

	{ command = 'swapWithMark:'; },

Now running the macro will start by setting a mark (at the current 
caret’s location) and then end with moving back the caret to this 
mark.


More information about the textmate mailing list