Giter Club home page Giter Club logo

magit-file-icons's Introduction

magit-file-icons.el

Display icons for filenames in Magit buffers!

Build status Version License

Preview

Magit status buffer with file icons

Magit revision diffstat with file icons

Installation

You can install this package from MELPA.

For example, with use-package:

(use-package magit-file-icons
  :ensure t
  :after magit
  :init
  (magit-file-icons-mode 1)
  :custom
  ;; These are the default values:
  (magit-file-icons-enable-diff-file-section-icons t)
  (magit-file-icons-enable-untracked-icons t)
  (magit-file-icons-enable-diffstat-icons t))

If you are using some other method to install, you will need to ensure the following dependencies:

  • el-patch
  • nerd-icons
  • magit

Nix

Alternatively, you can use Nix. This repository is a flake and outputs the following packages (versions omitted):

└───packages
    ├───aarch64-darwin
    │   ├───default: package 'emacs-magit-file-icons-vX.X.X'
    │   └───magit-file-icons: package 'emacs-magit-file-icons-vX.X.X'
    ├───aarch64-linux
    │   ├───default: package 'emacs-magit-file-icons-vX.X.X'
    │   └───magit-file-icons: package 'emacs-magit-file-icons-vX.X.X'
    ├───x86_64-darwin
    │   ├───default: package 'emacs-magit-file-icons-vX.X.X'
    │   └───magit-file-icons: package 'emacs-magit-file-icons-vX.X.X'
    └───x86_64-linux
        ├───default: package 'emacs-magit-file-icons-vX.X.X'
        └───magit-file-icons: package 'emacs-magit-file-icons-vX.X.X'

A minimal flake for creating an Emacs with the magit-file-icons package could look like this:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    magit-file-icons.url = "github:gekoke/magit-file-icons";
    magit-file-icons.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs =
    inputs:
    let
      system = "x86_64-linux";
      pkgs = inputs.nixpkgs.legacyPackages.${system};
    in
    {
      packages.${system}.default = pkgs.emacsWithPackages (_: [
        inputs.magit-file-icons.packages.${system}.default
      ]);
    };
}

Commentary

This package uses nerd-icons.el to render icons. Currently, this is the only supported icon backend.

The author is not opposed to adding additional icon backends — such as all-the-icons.el or vscode-icons-emacs — in the future.

magit-file-icons's People

Contributors

gekoke avatar dependabot[bot] avatar luke36 avatar

Stargazers

Siavash Askari Nasr avatar Dunaevsky Maxim avatar  avatar toyboot4e avatar Furkan Karataş avatar Valentin Laurent avatar Gabriel Ramos avatar Daniel Kahlenberg avatar Sebastian Stabinger avatar Aliaksei Yaletski avatar Sturla Idsoe avatar Sergei Pashakhin avatar StrawberryTea avatar Tony Merlin avatar Péter Böröcz avatar Amory Meltzer avatar David Jankoski avatar Tasmo avatar 我没有抓狂 avatar 肥肥 avatar Rafael Nicdao avatar DarkBuffalo avatar Roman Dronov avatar Sebastian Wålinder avatar  avatar  avatar Fabrizio Contigiani avatar Jian Wang avatar Pablo Torres avatar stardiviner avatar

Watchers

 avatar

magit-file-icons's Issues

enable magit-file-icons failed.

ENV:
OS: Arch Linux (newest)
Emacs: archlinuxcn/emacs-native-comp-git
Emacs pkgs: Melpa newest. In particular, magit-20240625.2109, el-patch-20231123.2216, nerd-icons-20240524.311

Use the following configuration to enable magit-file-icons:

  (use-package magit-file-icons
    :ensure t
    :after (magit nerd-icons)
    :init
    (magit-file-icons-mode 1)
    :custom
    ;; These are the default values:
    (magit-file-icons-enable-diff-file-section-icons t)
    (magit-file-icons-enable-untracked-icons t)
    (magit-file-icons-enable-diffstat-icons t))

(Press C-x C-e after it)

Error msg logged:

Debugger entered--Lisp error: (user-error "Resolving ‘magit-insert-untracked-files’ template failed -- at least one template did not match any form in")
  user-error("Resolving `%s' template failed -- at least one template did not match any form in" magit-insert-untracked-files)
  el-patch--resolve-template(magit-insert-untracked-files defun)
  el-patch-eval-template(magit-insert-untracked-files defun)
  magit-file-icons-mode(1)
  (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(magit-file-icons-enable-diff-file-section-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-untracked-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-diffstat-icons t nil nil "Customized with use-package magit-file-icons"))) (magit-file-icons-mode 1) (require 'magit-file-icons nil nil))
  #f(lambda () [t] (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(magit-file-icons-enable-diff-file-section-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-untracked-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-diffstat-icons t nil nil "Customized with use-package magit-file-icons"))) (magit-file-icons-mode 1) (require 'magit-file-icons nil nil)))()
  eval-after-load(magit #f(lambda () [t] (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(magit-file-icons-enable-diff-file-section-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-untracked-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-diffstat-icons t nil nil "Customized with use-package magit-file-icons"))) (magit-file-icons-mode 1) (require 'magit-file-icons nil nil))))
  #f(lambda () [t] (eval-after-load 'magit #'(lambda nil (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(magit-file-icons-enable-diff-file-section-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-untracked-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-diffstat-icons t nil nil "Customized with use-package magit-file-icons"))) (magit-file-icons-mode 1) (require 'magit-file-icons nil nil)))))()
  eval-after-load(nerd-icons #f(lambda () [t] (eval-after-load 'magit #'(lambda nil (progn (let ((custom--inhibit-theme-enable nil)) (if (memq 'use-package custom-known-themes) nil (custom-declare-theme 'use-package 'use-package-theme nil (list)) (enable-theme 'use-package) (setq custom-enabled-themes (remq 'use-package custom-enabled-themes))) (custom-theme-set-variables 'use-package '(magit-file-icons-enable-diff-file-section-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-untracked-icons t nil nil "Customized with use-package magit-file-icons") '(magit-file-icons-enable-diffstat-icons t nil nil "Customized with use-package magit-file-icons"))) (magit-file-icons-mode 1) (require 'magit-file-icons nil nil))))))
  (progn (use-package-ensure-elpa 'magit-file-icons '(t) '(:demand t)) (eval-after-load 'nerd-icons #'(lambda nil (eval-after-load 'magit #'(lambda nil (progn ... ... ...))))))
  (progn (progn (use-package-ensure-elpa 'magit-file-icons '(t) '(:demand t)) (eval-after-load 'nerd-icons #'(lambda nil (eval-after-load 'magit #'(lambda nil ...))))))
  eval((progn (progn (use-package-ensure-elpa 'magit-file-icons '(t) '(:demand t)) (eval-after-load 'nerd-icons #'(lambda nil (eval-after-load 'magit #'...))))) t)
  elisp--eval-last-sexp(nil)
  #f(compiled-function () #<bytecode 0x8a29c757640a>)()
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

`magit-file-files-mode` enable error on Emacs startup

After installed this package, I restart Emacs, got bellowing error.

Here is the backtrace show at bellowing:

Debugger entered--Lisp error: (magit-outside-git-repo . "~/")
  signal(magit-outside-git-repo "~/")
  magit--not-inside-repository-error()
  magit--toplevel-safe()
  magit-get-mode-buffer(magit-status-mode)
  magit-refresh()
  magit-file-icons-mode(1)
  (progn (magit-file-icons-mode 1) t)
  (condition-case err (progn (magit-file-icons-mode 1) t) ((debug error) (funcall use-package--warning534 :config err)))
  (if (not (require 'magit-file-icons nil t)) (display-warning 'use-package (format "Cannot load %s" 'magit-file-icons) :error) (condition-case err (progn (magit-file-icons-mode 1) t) ((debug error) (funcall use-package--warning534 :config err))))
  #f(lambda () :dynbind (if (not (require 'magit-file-icons nil t)) (display-warning 'use-package (format "Cannot load %s" 'magit-file-icons) :error) (condition-case err (progn (magit-file-icons-mode 1) t) ((debug error) (funcall use-package--warning534 :config err)))))()
  eval-after-load(magit #f(lambda () :dynbind (if (not (require 'magit-file-icons nil t)) (display-warning 'use-package (format "Cannot load %s" 'magit-file-icons) :error) (condition-case err (progn (magit-file-icons-mode 1) t) ((debug error) (funcall use-package--warning534 :config err))))))
  (condition-case err (eval-after-load 'magit #'(lambda nil (if (not (require 'magit-file-icons nil t)) (display-warning 'use-package (format "Cannot load %s" 'magit-file-icons) :error) (condition-case err (progn (magit-file-icons-mode 1) t) ((debug error) (funcall use-package--warning534 :config err)))))) ((debug error) (funcall use-package--warning534 :catch err)))
  eval-buffer(#<buffer  *load*-853980> nil "/Users/stardiviner/.config/emacs/init/programming/vcs/init-prog-vcs-git.el" nil t)  ; Reading at buffer position 7432
  load-with-code-conversion("/Users/stardiviner/.config/emacs/init/programming/vcs/init-prog-vcs-git.el" "/Users/stardiviner/.config/emacs/init/programming/vcs/init-prog-vcs-git.el" nil nil)
  #<subr load>("init-prog-vcs-git" nil nil nil nil)
  ad-Advice-load(#<subr load> "init-prog-vcs-git")
  apply(ad-Advice-load #<subr load> "init-prog-vcs-git")
  load("init-prog-vcs-git")
  eval-buffer(#<buffer  *load*-953716> nil "/Users/stardiviner/.config/emacs/init/programming/vcs/init-prog-vcs.el" nil t)  ; Reading at buffer position 459
  load-with-code-conversion("/Users/stardiviner/.config/emacs/init/programming/vcs/init-prog-vcs.el" "/Users/stardiviner/.config/emacs/init/programming/vcs/init-prog-vcs.el" nil nil)
  #<subr load>("init-prog-vcs" nil nil nil nil)
  ad-Advice-load(#<subr load> "init-prog-vcs")
  apply(ad-Advice-load #<subr load> "init-prog-vcs")
  load("init-prog-vcs")
  eval-buffer(#<buffer  *load*> nil "/Users/stardiviner/.config/emacs/init.el" nil t)  ; Reading at buffer position 6723
  load-with-code-conversion("/Users/stardiviner/.config/emacs/init.el" "/Users/stardiviner/.config/emacs/init.el" t t)
  load("/Users/stardiviner/.config/emacs/init" noerror nomessage)
  #f(compiled-function () #<bytecode 0x12e013edbcfb9591>)()
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x13d0b598f0f8bb12>) #f(compiled-function () #<bytecode -0x15951949e52a4b4f>) t)
  command-line()
  normal-top-level()

Here is my config:

(use-package magit-file-icons
  :ensure t
  :after magit
  :config (magit-file-icons-mode 1))

Repeated question about following links when opening status

Observed behaviour

When opening the magit status, magit-status, the first time in a workspace I get the question

Symbolic link to Git-controlled source file; follow link? (y or n)

I have to press y several times before I'm shown the magit status.

This happens for every repository I've tried so far, and it's repeated after restarting Emacs

Desired behaviour

Not having the question come up at all 😁

My config

My setup of magit-file-icons looks like this

(use-package magit-file-icons
  :after magit
  :init (magit-file-icons-mode 1))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.