dired minor mode to ignore files that are to be ignored by git.
Sometimes the working copy directories of your git repos get flooded with
temporary files, log files, cache stuff – in short files not belonging to the
repo and ignored by git. At those times you might wish for a convenient way to
hide those files in your dired
buffer. If yes, dired-gitignore
is for you.
Hide and show the gitignored files by a simple configurable keystroke.
Easiest way to install is from MELPA. If you have configured the MELPA sources
you can just install the dired-gitignore
package using the package-install
command.
You can of course also use straight.el. Put the following lines into your startup file.
(straight-use-package '(dired-gitignore :type git :host github :repo "johannes-mueller/dired-gitignore.el"))
Just bind the command (dired-gitignore-global-mode)
to some key of your choice. For
example by putting something like
(define-key dired-mode-map (kbd "h") #'dired-gitignore-global-mode)
into your startup files. Then you will hide and show the gitignored files in a
dired buffer by hitting the H
key.
If you want to ignore gitignored files by default add also
(dired-gitignore-global-mode t)
It started off as a rainy Sunday afternoon hack. Although it matured in some way over more than two years, probably not everything will work under any circumstances. Bug reports and feedback welcome in the issue tracker. Pull requests also, of course. In the meantime it turns out to be quite stable, as it does not seem to cause any trouble.
A standard UNIX shell is required for dired-gitignore.el
to work. If you
experience issues with the standard shell you are using you might consider
setting the shell-file-name
variable to /bin/bash
or so to change it.
There is a way more sophisticated package dired-filter.el
of the
dired-hacks suite. It can do things like this one and many more. So if you
have more complicated needs regarding filtering in dired
this might be a
better bet for you. However, dired-filter.el
is also more complex, it has
more than 1200 lines of code plus some heavy dependencies as opposed to less
than 100 in dired-gitignore
with dired
as only dependency.
This package has been inspired by dired-hide-dotfiles.