开发者

How do I get Dired to not display certain files?

开发者 https://www.devze.com 2023-03-03 03:28 出处:网络
For instance I\'d like it to not display all files that match the pattern *~ EDIT: The below worked: (add-hook \'dired-load-hook

For instance I'd like it to not display all files that match the pattern *~

EDIT: The below worked:

(add-hook 'dired-load-hook
      (lambda ()
        (load "dired-x")
        ;; Set dired-x global variables here.  For example:
        ;; (setq dired-guess-shell-gnutar "gtar")
        ;; (setq dired-x-hands-off-my-keys nil)
        ))
(setq dired-omit-files "^#\\|~$")
(add-hook 'dired-mode-hook
      (lambda ()
        ;;开发者_如何学C Set dired-x buffer-local variables here.  For example:
        (dired-omit-mode 1)
        ))


If you use dired-x, read here, or fir dired, read this discussion. In the case of dired, the suggested solution takes a regex that would filter out what is to be shown and displays only those files. This could be a bit tricky in your case.


Answered over on SuperUser, but I'll answer here, too. Use dired-omit:

Dired-Omit minor mode (indicator Omit):
Toggle Dired-Omit mode.
With numeric ARG, enable Dired-Omit mode if ARG is positive, disable
otherwise.  Enabling and disabling is buffer-local.
If enabled, "uninteresting" files are not listed.
Uninteresting files are those whose filenames match regexp `dired-omit-files',
plus those ending with extensions in `dired-omit-extensions'.

dired-omit is part of dired-x.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号