Tidying up Dired
Bit by bit I am getting to grips with
dired and using this for more operations on my files.
The next step is to reduce the listing width so that a listing fits better in a smaller window.
Here is the format of my current listing:
-al, which gives a standard long listing. Unfortunately for my work within emacs this is actually now too long, and also not just in emacs but in my terminal too.
After much hunting around the man page including potentially formatting the output and selecting the listing fields manually, I came to the conclusion that it is mainly the group and user I want to remove for the moment, and fortunately there are a couple of arguments that can do this for me:
-g like -l, but do not list owner -G, --no-group in a long listing, don't print group names
and while scrolling through the man page I also thought that making the sizes human readable would also be useful, so I have come up with the following in my
(setq dired-listing-switches "-lGgha")
to give me the following dired output:
This is much better, but can I now go further?
Well this is emacs, and you betcha!!!!
I know of the command
( which when in dired mode hides the details and shows just the files. Wouldn’t it be great to have this enabled by default?
describe-key gives me the following function:
(dired-hide-details-mode &optional ARG)
But it is not clear how I can set this by default, there is nothing obvious in
customize-group for dired, so now to the interwebs…
It looks as though I will need to add to the
dired-mode-hook and set the details to be hidden when dired mode is activated as follows:
;; dired hide long listing by default (defun my-dired-mode-setup () "show less information in dired buffers" (dired-hide-details-mode 1)) (add-hook 'dired-mode-hook 'my-dired-mode-setup)
Which now gives me:
and now if I want show the details I just select
( so effectively generally showing details rather than hiding them.
This makes more sense for my workflow in emacs, especially now my buffers and windows are getting a little more numerous and I am still really focussing on trying to use a single emacs frame on a laptop.