Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ivy.el: Allow toggling of sorting in ivy-read #845

Closed
wants to merge 1 commit into from

Commits on Jan 4, 2017

  1. ivy.el: Allow toggling of sorting in ivy-read

    Modify ivy-sort-functions-alist to allow a list of sorting functions to apply to
    a collection. The car of this list is the current one. ivy-rotate-sort then
    rotates this list through the different possibilities. I bound it to C-c
    C-s. Here is a simple example to illustrate.
    
    (setq ivy-sort-functions-alist
      '((read-file-name-internal .
        (ivy-sort-file-function-default string-lessp string-greaterp))
        (internal-complete-buffer . nil)
        (counsel-git-grep-function . nil)
        (Man-goto-section . nil)
        (org-refile . nil)
        (t . string-lessp)))
    
    M-x find-file RET C-c C-s now switches from the default sorting to using
    string-lessp. C-c C-s again switches to string-greaterp and so on.
    
    ivy.el (ivy-sort-functions-alist): Allow list in cdr of each cell
    ivy.el (ivy-rotate-sort): Add
    ivy.el (ivy--sort-function): Add and use for
    lookup in ivy-sort-functions-alist
    justbur committed Jan 4, 2017
    Configuration menu
    Copy the full SHA
    e4ad137 View commit details
    Browse the repository at this point in the history