Skip to content

Commit ac8c0fe

Browse files
committed
feat: nerd icons support (#8)
1 parent 60208db commit ac8c0fe

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

file-info.el

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
;; Author: Artur Yaroshenko <artawower@protonmail.com>
66
;; URL: https://github.com/artawower/file-info.el
77
;; Package-Requires: ((emacs "28.1") (hydra "0.15.0") (browse-at-remote "0.15.0"))
8-
;; Version: 0.8.0
8+
;; Version: 0.9.0
99

1010
;; This program is free software; you can redistribute it and/or modify
1111
;; it under the terms of the GNU General Public License as published by
@@ -286,15 +286,18 @@
286286
(root (file-info--get-project-root)))
287287
(caddr (file-info--get-first-commit-info))))
288288

289-
(defun file-info--file-icon ()
290-
"Return icon for current file."
291-
(when-let ((icons-available-p (fboundp 'all-the-icons-icon-for-mode))
292-
(icon-for-mode (all-the-icons-icon-for-mode major-mode :height 1.0 :v-adjust -0.05))
293-
(icon-exist-p (stringp icon-for-mode)))
289+
(defun file-info--get-icon ()
290+
"Get icon for current major mode."
291+
(or (and (fboundp 'nerd-icons-icon-for-mode)
292+
(nerd-icons-icon-for-mode major-mode))
293+
(and (fboundp 'all-the-icons-icon-for-mode)
294+
(all-the-icons-icon-for-mode major-mode :height 1.0 :v-adjust -0.05))))
294295

295-
(concat
296-
icon-for-mode
297-
" ")))
296+
(defun file-info--file-icon ()
297+
"Return formatted icon for current file."
298+
(let ((icon (file-info--get-icon)))
299+
(or (and (stringp icon) (concat icon " "))
300+
"")))
298301

299302
(defun file-info--get-current-branch ()
300303
"Return current branch via VC."

0 commit comments

Comments
 (0)