Skip to content
set different face for different file types in dired buffer for emacs
Emacs Lisp
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
README.md
dired-filetype-face.el

README.md

dired-filetype-face

MELPA

Set different faces for different filetypes in dired

Getting started

The easiest way to get started is to install the package via MELPA:

(package-install 'dired-filetype-face)

Once installed, activate it by adding the following to your ~/.emacs startup file:

(require 'dired-filetype-face)

If you want to add a new face for new filetype(s):

   (deffiletype-face "mytype" "Chartreuse")

then either:

   (deffiletype-face-regexp mytype
     :extensions '("foo" "bar") :type-for-docstring "my type")

to match all files ending either ".foo" or ".bar", or equivalently:

   (deffiletype-face-regexp mytype
     :regexp "^  -.*\\.\\(foo\\|bar\\)$" :type-for-docstring "my type")

and finally:

   (deffiletype-setup "mytype" "mytype")

The :regexp form allows you to specify other things to match on each line of the dired buffer than (only) file extensions, such as the permission bits, the size and the modification times.

Pull Request for adding default extensions or changing current setting are welcome

Copyright & License

Copyright (C) 2011~2015, 纪秀峰. Released under the terms of the GNU GPL v3+.

Something went wrong with that request. Please try again.