Skip to content

Sort by linemode values #3382

@grimandgreedy

Description

@grimandgreedy

yazi --debug output

Yazi
    Version: 25.5.31 (Homebrew 2025-05-30)
    Debug  : false
    Triple : aarch64-apple-darwin (macos-aarch64)
    Rustc  : 1.87.0 (17067e9a 2025-05-09)

Ya
    Version: 25.5.31 (Homebrew 2025-05-30)

Emulator
    TERM                : Some("xterm-256color")
    TERM_PROGRAM        : Some("iTerm.app")
    TERM_PROGRAM_VERSION: Some("3.6.6")
    Brand.from_env      : Some(Iterm2)
    Emulator.detect     : Emulator { kind: Left(Iterm2), light: false, csi_16t: (0, 0), force_16t: false }

Adapter
    Adapter.matches    : Iip
    Dimension.available: Dimension { rows: 32, columns: 122, width: 1952, height: 1088 }

Desktop
    XDG_SESSION_TYPE           : None
    WAYLAND_DISPLAY            : None
    DISPLAY                    : Some("/private/tmp/com.apple.launchd.ybDwC1ilFo/org.xquartz: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: "nvim \"$@\"", block: true, orphan: false, desc: "NeoVim", for: None, spread: true })
    block-create: Some(OpenerRule { run: "nvim \"$@\"", block: true, orphan: false, desc: "NeoVim", for: None, spread: true })
    block-rename: Some(OpenerRule { run: "nvim \"$@\"", block: true, orphan: false, desc: "NeoVim", 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.41
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 8.0.1 / 8.0.1
    pdftoppm      : 25.11.0
    magick        : 7.1.2-8
    fzf           : 0.67.0
    fd/fdfind     : 10.3.0 / No such file or directory (os error 2)
    rg            : 15.1.0
    chafa         : No such file or directory (os error 2)
    zoxide        : 0.9.8
    7zz/7z        : 25.01 / No such file or directory (os error 2)
    resvg         : 0.45.1
    jq            : 1.7.1

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

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

Please describe the problem you're trying to solve

Problem

I am working on creating a plugin that shows media information for audio/video files (e.g., duration, resolution) in the linemode, and I want to be able to sort the files based on the duration that is in that field.

Unless I am mistaken, I can't create a custom sort method in my lua plugin and call that to sort the files. If there is a way to do this, then that is awesome; could you point me to that? I have searched around and I think the sort methods are defined in the sorter.rs file.

Solutions

  1. Allow custom sort methods to sort the files from plugins

  2. Add a sort by linemode method.

Is it possible to have some sort of linemode sort so that once I set the linemode to duration or resolution, I can do [",", "l"] to sort by the linemode value? Or is there a way to create a custom sort method in a plugin?

What is the interface between the lua plugins and rust? Are the linemode values accessible in rust?

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

I'm happy to give it a shot, but I'll need some guidance since I'm not very familiar with the codebase and I'm uncertain whether the plugins support data caching that Rust can access.

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

    featureNew feature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions