8

Having a long routines, one gets sometimes lost and it would be handy to know which class/function the cursor is currently in (without the need to scroll all the way up, looking for the first outer block declaration). Any ideas how to get this in Sublime Text 3?

I'm mostly interested in a solution for Python, but I suppose there should be some general way (plugin?) to have this. I can imagine having the name written in the status bar, for example.

knaperek
  • 2,113
  • 24
  • 39

1 Answers1

5

If you press accel-r, or type @ inside the Quick-open files by name command palette(accel-p), you can see the current method/routine name highlighted. All this is in the default key binding of course.

Edit: after looking around, I found Function Name Display which does exactly what you want. It shows the current function name in the status bar.

XrXr
  • 2,027
  • 1
  • 14
  • 20
  • 1
    Yes, but I only see a function (not the class), and it's also a bit inconvenient to press accel-r just to see this information. If it's justified to show the info about line and column number in the status bar all the time, then I believe the class name is not less appropriate. – knaperek Jun 17 '14 at 20:35
  • 1
    I found a package that does what you want. It only shows the function name though, not class name and function name. – XrXr Jun 17 '14 at 20:46
  • 2
    Thanks for the tip, but unfortunately it is quite naive and limited. It does not track the end of a function (or class), and is easily confused by nested classes (which makes it unusable for Django models with Meta class defined). – knaperek Jun 19 '14 at 10:53
  • The repository linked hasn't been updated in a while, and currently one of the features (class name display) isn't working. This [fork](https://github.com/andfaulkner/SublimeFunctionNameDisplay) fixes it beautifully, so I suggest linking the post to it. Hope it gets merged back to the original repo (I have no affiliation to neither). – Dennis Golomazov Sep 26 '19 at 09:33