/
DiredOmitMode
30 lines (18 loc) · 1.65 KB
/
DiredOmitMode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
DiredOmitMode lets you hide uninteresting files, such as backup files and AutoSave files, from the DiredMode view.
It is defined in the [[Dired X]] package, so you must also arrange to load that:
;; Load Dired X when Dired is loaded.
(add-hook 'dired-load-hook '(lambda () (require 'dired-x)))
;; Enable toggling of uninteresting files.
(setq dired-omit-files-p t)
`M-o' in Dired buffers will toggle hiding of files. Variables `dired-omit-files' (note: no `-p' at end) and `dired-omit-extensions' together define the uninteresting files.
With most recent Emacs versions (e.g. 23.1.92.1) no hooks are needed and the following lines in your .emacs enable omit mode (in this example "dot" files are omitted):
(require 'dired-x)
(setq-default dired-omit-files-p t) ; this is buffer-local variable
(setq dired-omit-files
(concat dired-omit-files "\\|^\\..+$"))
----
One thing that I want is for dot-files (e.g., .bashrc, .emacs, etc.) to be colored in the same dim face that the other uninteresting files are colored in. I set (setq dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$\\|^\\..*$"), which does hide my dot-files when I hit M-o, but these files aren't colored in the dim face. It seems it only dims the files that match the extensions in dired-omit-extensions, but obviously this won't work for dot-files. Does anyone have a work-around for this? Thanks.
-- parolang
'''See also Dired+''' (DiredPlus), for a way to color less-interesting files differently in Dired. Combined with DiredOmitMode, this can do either of the following:
* Give you two levels of disinterest.
* Let you ''see'' uninteresting files, but not have them stand out.