Skip to content

gekoke/magit-file-icons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.