diff options
author | trungtq <taquangtrungvn@gmail.com> | 2021-09-13 12:24:52 +0800 |
---|---|---|
committer | trungtq <taquangtrungvn@gmail.com> | 2021-09-13 12:24:52 +0800 |
commit | 3b616ac5039e94bc33d12161a03f5a9164c73790 (patch) | |
tree | 1ece790675342db0968973d759582faae5577dae /helm-for-files.el | |
parent | d8aca8857642fe90199c9942f7ff119027dd2df4 (diff) |
highlight filename extension when find files
Diffstat (limited to 'helm-for-files.el')
-rw-r--r-- | helm-for-files.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/helm-for-files.el b/helm-for-files.el index a0c0f61e..d4388a60 100644 --- a/helm-for-files.el +++ b/helm-for-files.el @@ -193,11 +193,18 @@ Colorize only symlinks, directories and files." 'match-part (funcall mp-fn disp) 'help-echo (expand-file-name i)) i)) - (t (cons (propertize disp - 'face 'helm-ff-file - 'match-part (funcall mp-fn disp) - 'help-echo (expand-file-name i)) - i))))) + (t (let* ((ext (file-name-extension disp)) + (disp (propertize disp + 'face 'helm-ff-file + 'match-part (funcall mp-fn disp) + 'help-echo (expand-file-name i)))) + (when (condition-case _err + (string-match (format "\\.\\(%s\\)$" ext) disp) + (invalid-regexp nil)) + (add-face-text-property + (match-beginning 1) (match-end 1) + 'helm-ff-file-extension nil disp)) + (cons disp i)))))) (defclass helm-files-in-current-dir-source (helm-source-sync helm-type-file) ((candidates :initform (lambda () |