Create a .dir-locals.el
file in the directory of interest, with the following contents:
((dired-mode . ((dired-omit-files . "\\.html\\'"))))
If you want to omit the usual suspects as well, then use this regexp (which is the OR of the standard value with the html
value above):
"\\`[.]?#\\|\\`[.][.]?\\'\\|\\.html\\'"
Visiting the directory will ask about allowing the local variable which you can accept and enable for future visits with !
. Assuming that one way or another, you have enabled dired-omit-mode
(e.g. with M-x dired-omit-mode RET
), then any .html
files are omitted.
To enable dired-omit-mode
always, see the doc string for the function: C-h f dired-omit-mode
, which says:
To enable omitting in every Dired buffer, you can put this in
your init file:
(add-hook 'dired-mode-hook (lambda () (dired-omit-mode)))
This applies to the directory of interest and its subdirectories. I don't know of a way to limit it to just the directory of interest using .dir-locals.el
. It might be possible to do it using the more advanced mechanisms that are mentioned in the "Per-directory local variables" section of the manual (which you can get to with C-h i g (emacs)directory variables RET
), but I have not gone down that route at all.