[TxMt] Re: "Go to last edit" keyboard shortcut

Hans-Jörg Bibiko bibiko at eva.mpg.de
Wed Oct 28 14:02:37 UTC 2009


On Oct 16, 2009, at 9:01 PM, Alessandro Vernet wrote:
> Essentially, the idea is that when editing a file, I often move  
> around in
> the file to check other things and then want to come back to the  
> place I was
> editing to continue what I was doing. Now I have to remember to add a
> bookmark, before navigating around, then find that bookmark, and  
> remove it,
> which is a bit cumbersome.

I understood by "…move around…" scrolling to other places in the  
file WITHOUT moving the caret. By pressing ⇢ and ⇠ one scrolls back  
to the caret.

If you "move around" by using the caret then you can make usage of  
AppleScript (see also attachment):

Create a tmcommand:

Input: none
Output: discard
Command:
cat <<-AS | iconv -f UTF-8 -t MACROMAN | osascript -- 2>&1 1>/dev/null
tell application "TextMate" to activate
tell application "System Events" to tell process "TextMate" to tell  
menu bar 1 to tell menu bar item "Edit" to tell menu "Edit" to click  
menu item "Undo"
tell application "System Events" to tell process "TextMate" to tell  
menu bar 1 to tell menu bar item "Edit" to tell menu "Edit" to click  
menu item "Redo"
AS


The iconv stuff is only needed to be compatible with Tiger.

One could speed up it by pre-compiling the AppleScript and run it.


Cheers,

--Hans

-------------- next part --------------
A non-text attachment was scrubbed...
Name: GoToLastEdit.tmCommand
Type: application/octet-stream
Size: 1057 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20091028/c18ec323/attachment.tmCommand>


More information about the textmate mailing list