如何让 Dired 不显示某些文件?

如何让 Dired 不显示某些文件?

首先,我希望所有 *~ 文件都不会显示在 Dired 中。

编辑:以下有效:

(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 ()
        ;; Set dired-x buffer-local variables here.  For example:
        (dired-omit-mode 1)
        ))

答案1

看一下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是其一部分dired-x

相关内容