I read the following article: http://qerub.se/hiding-hidden-files-in-emacs-dired about hiding certain files in dired mode. I decided to hide more files and added a shortcut Alt-q, that will toggle the visibility of:
- All the hidden files, starting with dot.
- All Emacs backup files, ending with '~'.
I wrote the following code:
(setq dired-omit-files "^\\.$|~$")
(add-hook 'dired-mode-hook
(lambda ()
(define-key dired-mode-map (kbd "M-q") 'dired-omit-mode)
))
But only ~ files are hidded, not those, starting with dot. What is wrong?
M-x regex-builder
to troubleshoot. I used tool to generate this"^\\..+~?$"
which should work for you.abo-abo
. But it's better to use this one:"^\\..*~?$"
. It will hide the.
directory too.