Omitting a file means removing it from the directory listing. Omitting is useful for keeping Dired buffers free of "uninteresting" files (for instance, auto-save, auxiliary, backup, and revision control files) so that the user can concentrate on the interesting files. Like hidden files, omitted files are never seen by Dired. Omitting differs from hiding in several respects:
dired-omit-toggle
) Toggle between displaying and omitting
"uninteresting" files. With a prefix argument, don't toggle and just mark
the files, but don't actually omit them.
In order to make Dired Omit work you first need to load `dired-x.el'
inside dired-load-hook
(See section Installation) and then set
dired-omit-files-p
in some way (See section Omitting Variables).
The following variables can be used to customize omitting.
dired-omit-files-p
nil
If non-nil
, "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
. M-o
(dired-omit-toggle
) toggles its value, which is buffer-local. Put
(setq dired-omit-files-p t)inside your
dired-mode-hook
to have omitting initially turned on in
every Dired buffer (See section Installation). You can then use M-o to
unomit in that buffer.
To enable omitting automatically only in certain directories one can use Dired
Local Variables and put
Local Variables: dired-omit-files-p: t End:into a file `.dired' (the default value of
dired-local-variables-file
) in that directory (See section Local Variables for Dired Directories).
dired-omit-here-always
dired-local-variables-file
in the current directory and then refreshes
the directory listing (See section Local Variables for Dired Directories).
dired-omit-files
"^#\\|\\.$"
Filenames matching this buffer-local regexp will not be displayed.
This only has effect when dired-omit-files-p
is t.
The default value omits the special directories `.' and `..' and
autosave files (plus other files ending in ".") (See section Examples of Omitting Various File Types).
dired-omit-extensions
completion-ignored-extensions
(as defined in
the file `loaddefs.el' of the GNU Emacs distribution),
dired-latex-unclean-extensions
, dired-bibtex-unclean-extensions
and dired-texinfo-unclean-extensions
.
If non-nil
, a list of extensions (strings) to omit from Dired listings.
Its format is the same as that of completion-ignored-extensions
.
dired-omit-localp
'no-dir
The localp argument dired-omit-expunge
passes to
dired-get-filename
. If it is 'no-dir
, omitting is much faster,
but you can only match against the non-directory part of the filename. Set it
to nil
if you need to match the whole pathname or t
to match the
pathname relative to the buffer's top-level directory.
dired-omit-marker-char
(setq dired-mark-keys "\C-o") ;; i.e., the value of dired-omit-marker-char ;; (which is not defined yet)anywhere in your `~/.emacs', you will bind the C-o key to insert a C-o marker, thus causing these files to be omitted in addition to the usually omitted files. Unfortunately the files you omitted manually this way will show up again after reverting the buffer, unlike the others.
(setq dired-omit-files (concat dired-omit-files "\\|^RCS$\\|,v$"))in the
dired-load-hook
(See section Installation). This assumes
dired-omit-localp
has its default value of 'no-dir
to make the
^
-anchored matches work. As a slower alternative, with
dired-omit-localp
set to nil
, you can use /
instead of
^
in the regexp.
(setq dired-omit-files (concat dired-omit-files "\\|^INDEX$\\|-t\\.tex$"))in the
dired-load-hook
(See section Installation).
(setq dired-omit-files (concat dired-omit-files "\\|^\\..+$"))in the
dired-load-hook
(See section Installation).
Loading `dired-x.el' will install Dired Omit by putting
dired-omit-expunge
on your dired-after-readin-hook
, and will
call dired-extra-startup
, which in turn calls dired-omit-startup
in your dired-mode-hook
.
Go to the first, previous, next, last section, table of contents.