除了 Emacs Code Browser(ECB)之外,你知道哪些适用于Emacs的项目树浏览器?我看重这些特点:简洁、轻量和不受编程语言限制。
Projectile + NeoTree 是我选择的组合。
Projectile 会使用你的版本控制系统来跟踪文件,并拥有一个很棒的在项目中跳转到文件的功能。
另外,请查看笔记以了解如何将两者进行整合。
我自己还没有尝试过这个,但是emacs-nav是一个来自Google的新的Emacs项目浏览器,看起来它具有你所重视的功能。
package-list-packages
中搜索了“explore”一词,发现了project-explorer
。它似乎完全符合我今天的需求(我几乎不编码,但我正在掌握我的Jekyll网站的结构)。TAB
可以折叠和展开目录RET
或f
打开文件。带有C-u
前缀,它会很好地提示你选择哪个窗口,甚至允许你决定是使用窗口还是打开一个新的窗口到任何一侧(我没有在包代码中找到提示字符串,所以它似乎很好地利用了内置的Emacs功能;实际上它看起来甚至像dired
)。projectile
或helm
,但它与这些工具有一些集成。以下是我对几种竞争性文件资源管理器的看法。请参见下面每个包上方的评论:
;; 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 的良好替代品。希望这些信息可以帮助你节省一些时间。
我发现 dired-sidebar 很快很棒,但是由于一些小问题(图标、少数缺失的命令),我会继续使用 Treemacs 作为我的当前侧边栏。
我认为我不需要 Projectile,因为 Emacs 28.1 已经大大改进了 project.el。
侧边栏和内置项目应该足够了。
project-explorer
,似乎你可以使用C-u S-TAB
完全展开。 - Brady Trainor