How do I get Dired to not display certain files?
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
.
精彩评论