Wildcardjump-to

20061228338

When hacking away at thousand line files (or several thousand or just two hundred) I sometimes have a need to jump from the current line to either the beginning or end for a quick reference and then return to where I was. Perhaps this is the result of poor planning or bad code, but regardless, it’s still a need. For example, in CSS files I sometimes store common hex colors in a comment at the head of the file while in development. In Dreamweaver, jumping to the beginning or end is easy: ctrl+home and ctrl+end respectively. However getting back to where I was isn’t as simple as a quick key combo.

ctrl+g

Dreamweaver has a Go To Line shortcut. Press ctrl+g, enter a line number and it takes you there. Problem being I don’t want to look at a line number before jumping to the beginning or end of a file and I don’t want the extra step of entering it. Additionally, it doesn’t put my cursor right back where it was, rather just at the beginning of the line.

* ctrl+z

In cases where I just need to reference another section of the code but not actually make any changes, before pressing ctrl+home or ctrl+end, I type a single character. Then once I find the information I need, I can just press ctrl+z to undo the last change I made – the random character I typed. When undoing, Dreamweaver jumps the cursor back to where the edit occurred. Works great when I don’t have to actually change anything between jumps.

Another shortcut

Is there a solution to this that I’m unaware of? Do other text editors provide this functionality? Please do share. It may sound ridiculously lazy, but why spend time scrolling if you don’t have to? Perhaps rather than only have the ctrl+home shortcut, ctrl+alt+shift+home (ctrl+shift+home is already used to select everything from the cursor to the beginning of the document) could save the current cursor location before making the jump. Then repeating the sequence would jump back to that location and dump it from memory. That way edits could be made between jumps and ctrl+z wouldn’t lose its real functionality. Something similar for use with Find would be nice too.

If TextMate does this I’m buying a Mac tomorrow. Or soonish at least.

Comments

  1. jb 20061229

    i haven’t been able to find a shortcut like that for textmate but what i’ve been using instead is the bookmark functionality. Command + F2 creates a bookmark on the current line, then jump to whatever line you need, then F2 to jump to next bookmark. as long as you remember to delete the bookmark when you jump back to the line you are good. its not quite a “jump to last line I was on” but it gets the job done fairly easily.

  2. waytoocrowded 20061229

    Does Command+F2 act as a toggle to remove the bookmark or does deletion require some silly mouse usage?

  3. jb 20061229

    its a toggle.

  4. will 20070125

    ahem, Webuilder has similar keystrokable bookmark toggling/jumping. I never ever use it but I just tried JBs tip and it worked like a charm. tomorrow is a new day.


Skateboards and bikes are better at nights

Skateboards and bikes are better at nights. 0 comments.


Search WayTooCrowded
The Header Should Always Point Home