【问题标题】:How to get an outline view in sublime texteditor?如何在 sublime 文本编辑器中获得大纲视图?
【发布时间】:2011-01-05 17:28:45
【问题描述】:

如何在 Windows 的 sublime text editor 中获得大纲视图?

小地图很有帮助,但我错过了一个传统的大纲(我的代码中所有函数的可点击列表,按它们出现的顺序排列,以便快速导航和定位)

也许有插件、插件或类似的?如果您能简明扼要地指出哪些步骤是使其工作所必需的,那就太好了。

sublime text 论坛上有duplicate of this question

【问题讨论】:

  • 我为 SublimeText 3 添加了一个 feature request。欢迎为它投票。

标签: development-environment text-editor symbols outline sublimetext


【解决方案1】:

点击 CTRL+RCMD+R 对于 Mac 来获取函数列表。这适用于 Sublime Text 1.3 或更高版本。

【讨论】:

  • Ctrl+r 存在于当前的 beta 版本 (sublimetext.com/beta),但不存在于 1.2
  • 这太棒了,我真的错过了 Eclipse 的大纲视图。老实说,这要好得多,尽管我希望有一种方法可以让它只拉起主要功能而不是回调/成功功能。
  • 很遗憾,该列表未排序。我想念 Eclipse 的大纲视图和排序的函数列表。
  • real 大纲视图上是否有任何其他进展,例如 Eclipse 和 Oxygen 编辑器中可用的内容? ctrl+r 的不足之处在于没有说明已经概述了什么是变量还是类似的函数。
  • 这对于旧版本的 sublime 非常有用。对于最新版本,您始终可以使用包控件中提供的 Outline 包。
【解决方案2】:

包控制中有一个名为Outline的插件,试试吧! https://packagecontrol.io/packages/Outline

注意:它不适用于多行/多列模式。 对于多行/多列工作,请使用此 fork: https://github.com/vlad-wonderkidstudio/SublimeOutline

【讨论】:

  • 注意:要退出大纲视图,请单击大纲选项卡中的小关闭按钮,然后按Shift + Alt + 1 或转到查看 --> 布局 --> 单.要打开它备份使用Ctrl + Shift + P 然后搜索Browse Mode: Outline
【解决方案3】:

我使用折叠所有动作。它将最小化声明的所有内容,我可以看到所有的方法/函数,然后扩展我感兴趣的那个。

【讨论】:

  • 从 ST 3 菜单:编辑-代码折叠-全部折叠。快捷键 Ctrl+k, 1. Ctrl-k, j 撤消
【解决方案4】:

我简单看看SublimeText 3 apiview.find_by_selector(selector) 似乎可以返回一个地区列表。

所以我猜想一个可以显示文件大纲/结构的插件是可能的。

一个会显示如下内容的插件:

注意:function name display plugin 可用作提取类/方法名称的灵感,或ClassHierarchy 可用作提取大纲结构

【讨论】:

    【解决方案5】:

    如果您希望能够打印输出或保存大纲,ctr / command + r 不是很有用。 可以对以下 grep ^[^\n]*function[^{]+{ 或它的一些变体 执行简单的find all,以适应您正在使用的语言和情况.

    找到所有内容后,您可以将结果复制并粘贴到新文档中,根据功能的数量,整理起来应该不会花很长时间。

    答案远非完美,尤其是在 cmets 中包含单词 function(或等效词)的情况下,但我确实认为这是一个有用的答案。

    通过非常快速的编辑,这就是我现在正在处理的结果。

        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){};
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      • 1970-01-01
      • 2016-06-02
      • 2020-12-03
      • 2015-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多