如何让 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)
))
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 ()
;; Set dired-x buffer-local variables here. For example:
(dired-omit-mode 1)
))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 dired-x,请阅读此处,或者如果需要的话,请阅读此讨论< /a>.在 dired 的情况下,建议的解决方案采用正则表达式来过滤掉要显示的内容并仅显示这些文件。对于你的情况来说,这可能有点棘手。
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.
在超级用户上回答过,但我也会在这里回答。使用
dired-omit
:dired-omit
是dired-x
的一部分。Answered over on SuperUser, but I'll answer here, too. Use
dired-omit
:dired-omit
is part ofdired-x
.