Sublime Forum

[Feature] Cursor Forcus History

#1

It will be great to have commands to jump cursor(forcus) back and forth.
Ctrl+u has similar function to jump cursor back, but ctrl+u is part of undo history and can not “redo”(jump forth).
It is something more lilke an “cursor forcus history”. With this feature, I can jump to a function B
define from palce A (using search or cTag or any methods which changing the cursor forcus)
and revert forcus back to place A after I finished my work in function B.
I can’t find a plugin or command for this feature.
This feature is so helpful when tracing code.


A post from “technical support forum”.

0 Likes

#2

Hey bluebruce,

Have you tried bookmarks? (CTRL+F2, SHIFT+F2) Maybe that can help you?

0 Likes

#3

I would really like this feature built as well.

The way I see it, alt+left/right should step through the history, shift+alt+left/right will allow you to select while you jump.
The jump will try to go in blocks, i.e. if I moved down three lines quickly, one press will go up three lines.

@guillermooo: I’ll have to look into the bookmarks, but this feature would be a better fit for a lot of things (for basic editing, you’re not going to define a bookmark).

0 Likes

#4

@guillermooo
I’m a lazy and stupid guy. Bookmarks doesn’t work for me. Using bookmark interrupts my thinking flow when tracing code… ^^;

0 Likes

#5

@sublimator
Yes! cTags works great and has similar function I’m looking for.
I didn’t read the cTags plugin yet (I guess it is too complex to a plugin beginner…^^;)
I checked the API document, but I can’t find any API to be able to trace user’s cursor history.
I guess I can use view.show() and sublime.region to jump and record the cursor history,
but I can’t find the hook to get cursor position changes…

Any hint?

0 Likes

#6

You can get a notification when the cursor position changes via the onSelectionModified callback (subclass from sublimetext.com/docs/api-ref … gin.Plugin and just implement the onSelectionModified command). You’ll have to do some filtering on the results though, as you’ll get all modifications, even those from typing.

0 Likes