Fuco1 / dired-hacks

Collection of useful dired additions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Icons for dired subtree

ema2159 opened this issue · comments

I think this would be a pretty nice feature to have implemented adding support for both all the icons and treemacs icons dired

It's possible that an existing workaround might obviate bringing icons into the scope of dired-hacks.

If you use all-the-icons-dired (https://github.com/jtbm37/all-the-icons-dired), you can get icons in the dired buffer which is great. The only issue is that when you use dired subtree, it doesn't display the icons... But(!) when you revert the buffer, you can clearly see the icons there in the top-levels as well as the subtrees as you would expect!!!

So instead of binding dired-subtree-toggle to a key, I make my own wrapper (I try to avoid emacs 'advice')...

(defun chiply-dired-subtree-toggle () (interactive) (dired-subtree-toggle) (revert-buffer))

...and bind that instead. This way, every time you expand a directory, you automatically revert the buffer and see the icons. Note you would want to do a similar thing for dired-subtree-cycle if you use that too!

I can elaborate and offer more commentary if you run into trouble. Would this work for you? As a user of dired hacks, I'd want the existing, working implementation of icons in dired (all-the-icons-dired) to be the go to and to avoid re-inventing the wheel in dired-hacks - although I obviously defer to @Fuco1 for a philosophy on that ; - )

Thanks, this works! The only thing is I haven't been using Dired for quite some time (I've relied more on Treemacs and Ivy) but it's nice to have this solution and we can leave it here for other people to see! Thanks!

It's actually funny you say that bc i've moved around from neo-tree to treemacs to dired sidebar (because i know all my dired verbs and it's easier to configure). Now I use straight up dired, in minimal detail mode and I use display-buffer-alist to make sure it always snaps to the side window view. Couldn't be happier with it, and the real bonus is that all the nifty dired add ons (like icons in dired, everything in this repository) are super easy to configure in straight up dired (at least easier than in the various sidebar offerings nowadays).

A good example of this relative ease of use: I didn't even realize I wasn't getting my subtree icons in dired until i saw this comment. Took about 2 minutes to fix. Can't say the same for issues I've encountered with the other sidebars mentioned above!

Well that's true, Dired being a built-in solution is expected to be more reliable, although I'm hooked to Treemacs. It has so many nice features and integration with other stuff that I really find it useful.