Function: nerd-icons-icon-for-file

nerd-icons-icon-for-file is a byte-compiled function defined in nerd-icons.el.

Signature

(nerd-icons-icon-for-file &rest ARGS)

Source Code

;; Defined in /nix/store/yazcqi510kxs7jygyiirgf8qyg348f6p-emacs-packages-deps/share/emacs/site-lisp/elpa/nerd-icons-20260823.17/nerd-icons.el
;;;###autoload
(defun nerd-icons-icon-for-file (file &rest arg-overrides)
  "Get the formatted icon for FILE.
ARG-OVERRIDES should be a plist containining `:height',
`:v-adjust' or `:face' properties like in the normal icon
inserting functions."
  (let* ((name (file-name-nondirectory file))
         (ext (file-name-extension name))
         (icon (or (nerd-icons-match-to-alist name nerd-icons-regexp-icon-alist)
                   (and ext
                        (cdr (assoc (downcase ext)
                                    nerd-icons-extension-icon-alist)))
                   nerd-icons-default-file-icon))
         (args (cdr icon)))
    (when arg-overrides (setq args (append `(,(car args)) arg-overrides (cdr args))))
    (apply (car icon) args)))