【问题标题】:Emacs dirtree - Directory tree view setupEmacs ditree - 目录树视图设置
【发布时间】:2012-03-21 17:44:34
【问题描述】:

我对 emacs 很陌生,我正在尝试获取目录树。我关注了另一个StackOverFlow Emacs dirtree 问题,我的 .emacs 和 .emacs-d 如下:

.emacs

;; line number plugin
(add-to-list 'load-path' "~/.emacs-load-path")
(require 'linum)
(global-linum-mode 1)
;; auto complete plugin
(add-to-list 'load-path "~/.emacs.d")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
;; directory tree plugin
(add-to-list 'load-path "~/.emacs.d")
(require 'dirtree)
(require 'tree-mode)
(require 'windata)
(autoload 'dirtree "dirtree" "Add directory to tree view" t)

.emacs.d

dirtree.el
tree-mode.el
windata.el

我的问题是:

  1. 我是否设置正确,如果没有,我需要做什么?

  2. 如何在 emacs 中启动和使用 ditree?

【问题讨论】:

    标签: linux emacs directory-tree


    【解决方案1】:

    我测试了您的设置(尽可能接近),它可以很好地加载脏函数(和依赖项)。 ditree.el 文件尝试将 Cntl-o (\C-o) 映射到 dirtree-display 函数,但在我的系统上该函数失败。

    很高兴dirtree-show 函数工作正常。要手动调用它:

    1. M-x(输入 Alt-x 或 Esc-x)
    2. 类型:dirtree-show
    3. 回击
    4. 它会提示您输入要显示的目录 - 点击 Return 以显示当前文件的目录
    5. 脏树显示将在左侧的框架中弹出

    查看“树”菜单(如果您有在 emacs 中显示的菜单),它将显示您可以使用的击键快捷键。 (例如,“e”将切换当前节点的展开/折叠。)

    如果你不想每次都输入M-x dirtree-show,那么你可以绑定一个按键。我在我的 .emacs 中像这样绑定了 Cntl-o:

    (global-set-key "\C-o" 'dirtree-show)
    

    所以我对脏树的完整设置是这样的:

    (require 'tree-mode)
    (require 'windata)
    (require 'dirtree)
    (autoload 'dirtree "dirtree" "Add directory to tree view" t)
    (global-set-key "\C-o" 'dirtree-show)
    

    此外,据我所知,(autoload 'dirtree "dirtree" "Add directory to tree view" t) 行不是基本功能所必需的,但可能是我未使用的某些功能所必需的。

    最后,为了确保我们在同一页面上,我从 https://github.com/zkim/emacs-dirtree 下载了所有 .el 文件。

    【讨论】:

    • 很好的答案!这真的很有帮助,我现在有工作。感谢您花时间测试我的设置并提供如此详细的答案。
    • 很高兴它成功了。总是很高兴让更多人加入 emacs。
    【解决方案2】:

    试试NeoTree。它易于安装且易于使用。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多