Emacs的好用项目树浏览器?

47

除了 Emacs Code Browser(ECB)之外,你知道哪些适用于Emacs的项目树浏览器?我看重这些特点:简洁、轻量和不受编程语言限制。


1
我刚决定开始使用emacs,已经花了两天时间试图找到一个不糟糕的树。我不明白为什么这些包都不能让你展开整个目录结构,而不仅仅是第一层。 - iLemming
1
@Agzam,我在下面描述了project-explorer,似乎你可以使用C-u S-TAB完全展开。 - Brady Trainor
9个回答

29

Projectile + NeoTree 是我选择的组合。

Neotree

Projectile 会使用你的版本控制系统来跟踪文件,并拥有一个很棒的在项目中跳转到文件的功能。

Projectile

另外,请查看笔记以了解如何将两者进行整合。


24

Speedbar是什么?

如果你只想管理相关文件,也许你会喜欢eproject


1
当我提出这个问题时,我想到了类似Speedbar的东西。然而,您的eproject可能是我实际上正在寻找的,而我自己并不知道。目前,我依赖于iswitch和ibuffer,但当同时处理两个或三个项目时,它们往往变得非常拥挤。Eproject似乎解决了这个问题。 - pico
4
Speedbar 已经默认包含在 Emacs 24 中。 - Sridhar Ratnakumar

22

我自己还没有尝试过这个,但是emacs-nav是一个来自Google的新的Emacs项目浏览器,看起来它具有你所重视的功能。


1
我不太理解nav......它就像是sr-speedbar,但没有树状结构。没有树状结构有什么用呢? - robru

8

7
我刚才在package-list-packages中搜索了“explore”一词,发现了project-explorer。它似乎完全符合我今天的需求(我几乎不编码,但我正在掌握我的Jekyll网站的结构)。
关键包括:
  • TAB可以折叠和展开目录
  • 使用RETf打开文件。带有C-u前缀,它会很好地提示你选择哪个窗口,甚至允许你决定是使用窗口还是打开一个新的窗口到任何一侧(我没有在包代码中找到提示字符串,所以它似乎很好地利用了内置的Emacs功能;实际上它看起来甚至像dired)。
它可在Melpa和Marmalade上获取。它在Github上也有:sabof/project-explorer
为方便起见,我附上了该网站的图像: project-explorer screenshot 我不使用projectilehelm,但它与这些工具有一些集成。

7

我认为 cedet 的不同部分将会满足您的需求。 Speedbar 具有树形结构,而 EDE 则处理项目等内容。


5

以下是我对几种竞争性文件资源管理器的看法。请参见下面每个包上方的评论:

;; Dired itself allows one to do 'i' to insert (display in same buffer) the
;; subdirectory under point and C-u k on subdir header line to remove. However,
;; I have found that dired-subtree-toggle and dired-subtree-remove are a better solution for the removal
;; part. Plus dired-subtree let's you customize colors of subdirs to set them apart
;; visually. However, I set all depths of subdirectories custom faces to be the same as I found it distracting.
(use-package dired-subtree
  :ensure t
  :bind (:map dired-mode-map ("i" . 'dired-subtree-toggle))
  :bind (:map dired-mode-map ("I" . 'dired-subtree-remove)))


;; This works nicely. It provides the parent, '..', directory unlike nav.
(use-package project-explorer
  :ensure t
  :config
  (evil-set-initial-state 'project-explorer-mode 'emacs))

;; This can't go above the directory you started it in. It is nice, but I prefer the flexibility
;; of getting to parent directories in most cases.
(use-package dirtree
  :ensure t)

;; Google's file explorer
;; Nice, but doesn't maintain visited nodes in view, preferring instead to offer only
;; the current directory or lower in a side window. No better than ivy which is my main file explorer system.
(use-package nav
  :ensure t)

;; This is buggy on Emacs 26.1.
(use-package eproject
  :disabled t
  :ensure t)

;; speedbar is included with Emacs (since 24.x I believe). It has to use a separate frame, which is
;; inconvenient most of the time. There are better options (above).
;; (use-package speedbar)

;; Buggy; doesn't work on Emacs 26.1 (at least with my config).
(use-package sr-speedbar
  :disabled t
  :load-path "../lisp")

;; Buggy on Emacs 26.1 (at least with my config). I couldn't even get it to activate.
(use-package ecb
  :disabled t
  :ensure t)

;; Nice, but similar to ivy which I've already committed to, so not necessary.
(use-package lusty-explorer
  :disabled t
  :ensure t)

对于我来说,使用 ivy 和 dired 就能满足 98% 的需求。加上 dired-subtree 可以达到 99% 的需求。project-explorer 和 nav 这两个工具只是 ivy 和 dired 或者 ivy、dired 和 dired-subtree 的良好替代品。希望这些信息可以帮助你节省一些时间。


2

我使用过treemacs,它表现得很好,特别是与projectile一起使用时。


1
Treemacs非常酷。它已经取代了以前我最喜欢的neotree。 - shivams

0

我发现 dired-sidebar 很快很棒,但是由于一些小问题(图标、少数缺失的命令),我会继续使用 Treemacs 作为我的当前侧边栏。

我认为我不需要 Projectile,因为 Emacs 28.1 已经大大改进了 project.el
侧边栏和内置项目应该足够了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接