Skip to content
set different face for different file types in dired buffer for emacs
Emacs Lisp
Find file
Latest commit c51bb2d @jixiuf fix readme
Failed to load latest commit information.
.gitignore add .gitignore file fix readme
dired-filetype-face.el add more extensions



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.

Copyright & License

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

Something went wrong with that request. Please try again.