38

I love dired, but sometimes (particularly when filming screencasts) I want to see the tree-structure of a directory and its children, a la the tree(1) command. Is there a tree-oriented directory browser for Emacs?

  • Pretty sure ecb can do this. – Edgar Aroutiounian Sep 28 '14 at 21:34
  • 2
    @EdgarAroutiounian If that's the case, I recommend making an answer out of it :) – Trevoke Sep 29 '14 at 12:15
22

Additionally you can use dired-subtree from dired-hacks repo.

Here you have short demo and screenshot from my setup where I press i to drill down folder and ; to go back.:

  (define-key dired-mode-map "i" 'dired-subtree-insert)
  (define-key dired-mode-map ";" 'dired-subtree-remove)

dired-subtree

PS I'm also aware of direx which looks like that: direx:

  • I've tried dired-subtree but the tree structure wasn't as visually apparent as I was looking for. Direx looks perfect tho, I'm gonna go try it. – Avdi Sep 29 '14 at 22:40
  • I'm this one because the suggestion of Direx looks ideal for my use case of putting a directory tree visualization front and center. That's not to discount @keelerm's excellent suggestions though. – Avdi Sep 29 '14 at 22:49
22

There are a couple of options for this.

You can check out dirtree, which is based on dired.

There is also an emacs port of vim's NERDTree called neotree.

Both are excellent packages, though I tend to favor neotree as it has convenient bindings to let me create and delete files and directories. I do not believe dirtree has this support, though I could be wrong. It has been a while since I last used it.

  • Thanks, while direx looks to be ideal for my immediate need, you've reminded me that I need to spend some time with neotree. – Avdi Sep 29 '14 at 22:50
9

You can invoke dired with an argument, ie. C-u C-x d and after prompting for the directory it will also let you modify the switches passed to ls. Add R and dired will recursively list all sub-directories, each in it's own section.

If you only want to see the contents of some sub-directories, press i when the point is on a directory name.

You can also use the find-dired command, with or without switches. Instead of showing sub-directories in their own section it prints the full path of each file. You can toggle showing file details with ( so that the long paths fit horizontally on screen.

These are all built-in.

6

Have you ever tried Emacs' M-x speedbar? :-) before installing some new package I'd try an inbuilt solution...

  • 1
    …and one more upvote for suggesting a builtin. – GergelyPolonkai Sep 12 '17 at 18:20
4

There is also ztree. I use it when I need to take a look at directory structure, although usually I use vanilla Dired for all other things.

1

Take a look at sidebar.el.

As the repo said, it is is a customizable file explorer with git integration, but not only that. You can also get the list of buffers and your maildirs with mu4e.

enter image description here

1

Does Treemacs work. It allows you to have a treelike structure.

  • Is this an answer or a question (two questions)? It is pretty-much a link-only answer, if it is an answer. As such, it risks being deleted. See emacs.stackexchange.com/help/how-to-ask. – Drew Nov 18 '17 at 0:13
  • 1
    @Drew, fwiw I think this is just a language/interpretation issue. Treemacs is an absolutely acceptable suggestion to the OP's question. – EdwardGarson Jan 6 '18 at 4:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.