Sublime Forum

Caret move event

#1

Hello!
Is there a possibility to fire command when caret position changes?
Like status bar message “Line: xx Column: yy”

0 Likes

#2

You can do an event listener like such which will be fired when the cursor moves:

class MyListener(sublime_plugin.EventListener):
    def on_selection_modified(self, view):
        print ("MOVED!")
        # do something

I would be cautious when implementing this as it can lock up the application. There is an on_selection_modified_async event in Sublime Text 3 which is what I would use if possible.

-Nick

0 Likes

#3

Thank you! I already tried on_selection_modified, but it does not fire when I move cursor in the same line. So I can’t catch the moment when I’m getting into scope, e.g.

.homepageHighlights {

when cursor is between homepage and Highlights its’s one scope, when it is after { it’s another scope

0 Likes

#4

Sorry, my bad, I’ve found mistake :smile:

0 Likes