Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update display of directories #13

Open
tpadioleau opened this issue Apr 29, 2020 · 2 comments
Open

Update display of directories #13

tpadioleau opened this issue Apr 29, 2020 · 2 comments

Comments

@tpadioleau
Copy link

tpadioleau commented Apr 29, 2020

Hello,

I think the ivy function returning icon for files can be updated according to the recent function all-the-icons-icon-for-dir, see here.

I suggest to go from

(defun all-the-icons-ivy-icon-for-file (s)
  "Return icon for filename S.
Return the octicon for directory if S is a directory.
Otherwise fallback to calling `all-the-icons-icon-for-file'."
  (cond
   ((string-match-p "\\/$" s)
    (all-the-icons-octicon "file-directory" :face 'all-the-icons-ivy-dir-face))
   (t (all-the-icons-icon-for-file s))))

to

(defun all-the-icons-ivy-icon-for-file (s)
  "Return icon for filename S.
Return the octicon for directory if S is a directory.
Otherwise fallback to calling `all-the-icons-icon-for-file'."
  (cond
   ((file-directory-p s)
    (all-the-icons-icon-for-dir s :face 'all-the-icons-ivy-dir-face))
   (t (all-the-icons-icon-for-file s))))

This is what is currently implemented in all-the-icons-dired, see here. It gives nice icons for special directories.

Thanks

@tpadioleau
Copy link
Author

tpadioleau commented May 6, 2020

A small fix on this code, passing s for all-the-icons-icon-for-dir may not be enough I think it requires absolute path, so maybe consider this version

(defun all-the-icons-ivy-icon-for-file (s)
  "Return icon for filename S.
Return the octicon for directory if S is a directory.
Otherwise fallback to calling `all-the-icons-icon-for-file'."
  (let ((s-abs (expand-file-name s (ivy-state-directory ivy-last))))
    (cond
     ((file-directory-p s-abs)
      (all-the-icons-icon-for-dir s-abs :face 'all-the-icons-ivy-dir-face))
     (t (all-the-icons-icon-for-file s)))))

@asok
Copy link
Owner

asok commented Aug 18, 2020

I encourage you to open a PR for this. If you could include a screenshot showing the change that would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants