Skip to content

Combine different sorting methods #3064

@SuniRein

Description

@SuniRein

yazi --debug output

Yazi
    Version: 25.5.31 (VERGEN_IDEMPOTENT_OUTPUT 2025-05-31)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.87.0 (17067e9a 2025-05-09)

Ya
    Version: 25.5.31 (VERGEN_IDEMPOTENT_OUTPUT 2025-05-31)

Emulator
    TERM                : Some("xterm-kitty")
    TERM_PROGRAM        : None
    TERM_PROGRAM_VERSION: None
    Brand.from_env      : Some(Kitty)
    Emulator.detect     : Emulator { kind: Left(Kitty), light: false, csi_16t: (16, 32), force_16t: false }

Adapter
    Adapter.matches    : Kgp
    Dimension.available: Dimension { rows: 47, columns: 155, width: 2480, height: 1504 }

Desktop
    XDG_SESSION_TYPE           : Some("x11")
    WAYLAND_DISPLAY            : None
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL           : Some("/bin/zsh")
    EDITOR          : Some("nvim")
    VISUAL          : None
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: None

Text Opener
    default     : Some(OpenerRule { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for: None, spread: true })
    block-create: Some(OpenerRule { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for: None, spread: true })
    block-rename: Some(OpenerRule { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : No such file or directory (os error 2)
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file          : 5.45
    ueberzugpp    : 2.9.7
    ffmpeg/ffprobe: 6.1.1-2 / 6.1.1-2
    pdftoppm      : 22.12.0
    magick        : 7.1.1-36
    fzf           : 0.62.0
    fd/fdfind     : 10.2.0 / 10.2.0
    rg            : 14.1.1
    chafa         : 1.12.5
    zoxide        : 0.9.8
    7zz/7z        : No such file or directory (os error 2) / 23.01
    resvg         : 0.45.1
    jq            : 1.6

Clipboard
    wl-copy/paste: No such file or directory (os error 2) / No such file or directory (os error 2)
    xclip        : 0.13
    xsel         : 1.2.0

Routine
    `file -bL --mime-type`: text/plain

Please describe the problem you're trying to solve

I like sorting by natural. Howerver, sometimes I want to sort by extension and find that in this way 10 is before 2, unlike what happened in natural. How can I combine by extension and by natural?

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Allow combining different sorting methods, and when two items are the same priority, use the next method for sorting.

sort_by = ["extension", "natural"]

Additional context

No response

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions