123

How do I get an outline view in sublime text editor for Windows?

The minimap is helpful but I miss a traditional outline (a klickable list of all the functions in my code in the order they appear for quick navigation and orientation)

Maybe there is a plugin, addon or similar? It would also be nice if you can shortly name which steps are neccesary to make it work.

There is a duplicate of this question on the sublime text forums.

BryanH
  • 5,826
  • 3
  • 34
  • 47
user89021
  • 14,784
  • 16
  • 53
  • 65
  • 1
    I added a **[feature request](http://sublimetext.userecho.com/topic/631908-/)** for SublimeText 3. Feel free to vote for it. – Name is carl Mar 09 '15 at 20:48

5 Answers5

279

Hit CTRL+R, or CMD+R for Mac, for the function list. This works in Sublime Text 1.3 or above.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Cory Petosky
  • 12,458
  • 3
  • 39
  • 44
  • Sounds good. But nothing happens when I press ctrl-r. I have a php file open. Can I locate the command in a menu? Does this work without a plugin? karlthorwald – user89021 Feb 06 '10 at 03:34
  • I looked, but there is no ctrl-r in the key binding file (under preferences). Do you have it there? If so, which is the "commmand" for it? – user89021 Feb 06 '10 at 03:38
  • 6
    Ctrl+r exists in the current beta version (http://www.sublimetext.com/beta), but not in 1.2 – jskinner Feb 06 '10 at 23:09
  • Updated answer with jskinner's addition. – Cory Petosky Feb 09 '10 at 02:46
  • 2
    This is awesome and I was really missing outline view from Eclipse. This is honestly much better though I wish there was a way to have it pull up only the main functions and not the callbacks/success functions. – Michael BW Mar 12 '12 at 18:56
  • 1
    The list is not sorted, unfortunately. I miss having Eclipse's outline view with a sorted list of functions. – scorpiodawg Jul 31 '12 at 21:13
  • 2
    Any additional progress on a *real* outline view like what is available in Eclipse and Oxygen editors? Whats lacking with ctrl+r is there is no indication what has been outlined whether is is a variable or a functiona alike. – kstubs Oct 04 '14 at 02:17
  • Any idea if there's a way to exclude lamdas etc? I get a lot of ES6 `() =>` which are a bit annoying! – Ian May 10 '16 at 15:47
  • I don't write JavaScript, so not sure myself. Might be worth asking a top-level question about this, perhaps at Superuser (I suspect this question would have been deleted here if asked more recently) – Cory Petosky May 15 '16 at 01:21
  • Best feature ever. Right after auto-format. That's all i need. :) – Jo Smo Oct 26 '16 at 18:59
  • 1
    this is very much useful for older versions of sublime. For the latest versions, you can always use the Outline package that is available in the package control. – Harsha J K Sep 20 '19 at 15:12
  • For me, Ctrl+r opens an input box starting with a "@" symbol. Not sure what this means. – David Spector Sep 21 '19 at 21:08
24

A plugin named Outline is available in package control, try it! https://packagecontrol.io/packages/Outline

Note: it does not work in multi rows/columns mode. For multiple rows/columns work use this fork: https://github.com/vlad-wonderkidstudio/SublimeOutline

Vlad
  • 3
  • 2
Elian
  • 341
  • 2
  • 3
  • 2
    Note: To exit Outline view, click the little close button in the Outline tab, then press `Shift` + `Alt` + `1` or go to View --> Layout --> Single. To open it back up use `Ctrl` + `Shift` + `P` then search for `Browse Mode: Outline` – Gabriel Staples Jan 03 '18 at 21:33
  • it's pity, dosen't have close cmd, can't show in sidebar – yurenchen Jul 30 '22 at 01:52
18

I use the fold all action. It will minimize everything to the declaration, I can see all the methods/functions, and then expand the one I'm interested in.

Enmanuel Rivera
  • 402
  • 5
  • 6
9

I briefly look at SublimeText 3 api and view.find_by_selector(selector) seems to be able to return a list of regions.

So I guess that a plugin that would display the outline/structure of your file is possible.

A plugin that would display something like this:

code outline

Note: the function name display plugin could be used as an inspiration to extract the class/methods names or ClassHierarchy to extract the outline structure

Name is carl
  • 5,961
  • 3
  • 29
  • 44
0

If you want to be able to printout or save the outline the ctr / command + r is not very useful. One can do a simple find all on the following grep ^[^\n]*function[^{]+{ or some variant of it to suit the language and situation you are working in.

Once you do the find all you can copy and paste the result to a new document and depending on the number of functions should not take long to tidy up.

The answer is far from perfect, particularly for cases when the comments have the word function (or it's equivalent) in them, but I do think it's a helpful answer.

With a very quick edit this is the result I got on what I'm working on now.

    PathMaker.prototype.start = PathMaker.prototype.initiate = function(point){};
    PathMaker.prototype.path = function(thePath){};
    PathMaker.prototype.add = function(point){};
    PathMaker.prototype.addPath = function(path){};
    PathMaker.prototype.go = function(distance, angle){};
    PathMaker.prototype.goE = function(distance, angle){};
    PathMaker.prototype.turn = function(angle, distance){};
    PathMaker.prototype.continue = function(distance, a){};
    PathMaker.prototype.curve = function(angle, radiusX, radiusY){};
    PathMaker.prototype.up = PathMaker.prototype.north = function(distance){};
    PathMaker.prototype.down = PathMaker.prototype.south = function(distance){};
    PathMaker.prototype.east = function(distance){};
    PathMaker.prototype.west = function(distance){};
    PathMaker.prototype.getAngle = function(point){};
    PathMaker.prototype.toBezierPoints = function(PathMakerPoints, toSource){};
    PathMaker.prototype.extremities = function(points){};
    PathMaker.prototype.bounds = function(path){};
    PathMaker.prototype.tangent = function(t, points){};
    PathMaker.prototype.roundErrors = function(n, acurracy){};
    PathMaker.prototype.bezierTangent = function(path, t){};
    PathMaker.prototype.splitBezier = function(points, t){};
    PathMaker.prototype.arc = function(start, end){};
    PathMaker.prototype.getKappa = function(angle, start){};
    PathMaker.prototype.circle = function(radius, start, end, x, y, reverse){};
    PathMaker.prototype.ellipse = function(radiusX, radiusY, start, end, x, y , reverse/*, anchorPoint, reverse*/ ){};
    PathMaker.prototype.rotateArc = function(path /*array*/ , angle){};
    PathMaker.prototype.rotatePoint = function(point, origin, r){};
    PathMaker.prototype.roundErrors = function(n, acurracy){};
    PathMaker.prototype.rotate = function(path /*object or array*/ , R){};
    PathMaker.prototype.moveTo = function(path /*object or array*/ , x, y){};
    PathMaker.prototype.scale = function(path, x, y /* number X scale i.e. 1.2 for 120% */ ){};
    PathMaker.prototype.reverse = function(path){};
    PathMaker.prototype.pathItemPath = function(pathItem, toSource){};
    PathMaker.prototype.merge = function(path){};
    PathMaker.prototype.draw = function(item, properties){};
Trevor
  • 525
  • 2
  • 6
  • 19