Trying here to set color for executable files, as it is for ls command!
How can I do that?
I've already managed to set color for certains file extensions, using Diredful package, but couldn't do it according to it's mode!
Define "executable file" and a file's "mode".
If you mean something that ls
recognizes as executable and flags as such, with an asterisk (*
), when you use ls
switch F
, then Dired+ highlights that. It uses face `` for the asterisk.
;; For this to show up, you need `F' among the options in `dired-listing-switches'.
;; For example, I use "-alF" for `dired-listing-switches'.
(defface diredp-executable-tag
'((t (:foreground "Red")))
"Face used for executable tag (*) on file names in Dired buffers."
:group 'Dired-Plus :group 'font-lock-highlighting-faces)
diredful-add
, then named Type Name, which was Executables. In pattern I entered $*
, to match those binaries with *
at the end! And in Pattern Type just selected the last option, which was "Regexp on whole line (starting from the first permission column) including file name." So that way now I see the executable files highlighted in colors in Dired mode itself, and not only in Shell mode!
Commented
Aug 9, 2019 at 1:01
For a non-dired-plus version, I use this code to highlight executable files in dired-mode
by using the face helm-ff-executable
(it can be changed to any other face up to preference):
(add-to-list
'dired-font-lock-keywords
(list dired-re-exe
'(".+" (dired-move-to-filename) nil (0 'helm-ff-executable)))
'append)