dired-quick-sort: Sort Dired Buffers Quickly in Emacs

Last updated on December 10, 2016

While Dired is great for browsing the file system, it is often annoying that the buffer is not sorted in the way we want to see. While Dired provides the flexible customizing variable dired-listing-switches, it is still not convenient to switch between different sorting criteria quickly. For this reason, I created the Emacs extension dired-quick-sort to make sorting Dired an easy story.

Project Homepage

Screenshot

Installation

To install dired-quick-sort, you can use one of the following ways.

  • MELPA: dired-quick-sort can be installed from the MELPA repository. Follow the instructions to set up MELPA and then run package-install RET dired-quick-sort RET to install.

  • el-get: dired-quick-sort can be installed via el-get. Follow the instructions to set up el-get and then run el-get-install RET dired-quick-sort RET to install.

  • Manual: Download this package and add the following to your ~/.emacs or ~/.emacs.d/init.el:

    (add-to-list 'load-path "~/path/to/dired-quick-sort")
    (load "dired-quick-sort.el")

Configuration

You can add the following to your ~/.emacs or ~/.emacs.d/init.el for a quick setup:

(require 'dired-quick-sort)
(dired-quick-sort-setup)

This will bind “S” in dired-mode to invoke the quick sort hydra and new Dired buffers are automatically sorted according to the criterion that was used to sort last time. See the document of dired-quick-sort-setup if you need a different setup. It is recommended that at least -l should be put into dired-listing-switches. If used with diredp-hide-details-initially-flag to nil.

Usage

Start a Dired buffer and press “S”. Now just following the screen to sort in the way you want and the sorting criteria is automatically used for new Dired buffers!

2 thoughts on “dired-quick-sort: Sort Dired Buffers Quickly in Emacs

  1. mz

    How do I switch back to sorting by name? I know there’s a really easy way of doing so, and I’ve figured it out before, but I managed to forget somehow and now I’m once more lost …

    If I switch to “none” in the hydra buffer (“Shift-S n q”) then my dired buffer just looks totally scrambled. More precisely, I can then press “s” to switch between two scrambled versions.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *