Skip to content

Feature to toggle "sort_dir_first" by shortcut key #3157

@zerobikappa

Description

@zerobikappa

yazi --debug output

Yazi
    Version: 25.5.31 (Arch Linux 2025-07-23)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.88.0 (6b00bc38 2025-06-23)

Ya
    Version: 25.5.31 (Arch Linux 2025-07-23)

Emulator
    TERM                : Some("xterm-256color")
    TERM_PROGRAM        : Some("terminology")
    TERM_PROGRAM_VERSION: Some("1.14.0")
    Brand.from_env      : None
    Emulator.detect     : Emulator { kind: Right(Unknown { kgp: false, sixel: false }), light: false, csi_16t: (0, 0), force_16t: false }

Adapter
    Adapter.matches    : X11
    Dimension.available: Dimension { rows: 40, columns: 147, width: 0, height: 0 }

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("/usr/bin/bash")
    EDITOR          : None
    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:-vim} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for: None, spread: true })
    block-create: Some(OpenerRule { run: "${EDITOR:-vim} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for: None, spread: true })
    block-rename: Some(OpenerRule { run: "${EDITOR:-vim} \"$@\"", 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.46
    ueberzugpp    : 2.9.7
    ffmpeg/ffprobe: 7.1.1 / 7.1.1
    pdftoppm      : 25.09.1
    magick        : 7.1.2-3
    fzf           : 0.65.2
    fd/fdfind     : 10.3.0 / No such file or directory (os error 2)
    rg            : 14.1.1
    chafa         : 1.16.2
    zoxide        : 0.9.8
    7zz/7z        : No such file or directory (os error 2) / 25.01
    resvg         : No such file or directory (os error 2)
    jq            : 1.8.1

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

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


See https://yazi-rs.github.io/docs/plugins/overview#debugging on how to enable logging or debug runtime errors.

Please describe the problem you're trying to solve

Currently I added two shortcut key in keymap.toml to set the "dir_fist" behavior:

[mgr]
keymap = [
	{ on = [ ",", "f" ], run = "sort --dir-first=no",                           desc = "Unset dir_first sort" },
	{ on = [ ",", "F" ], run = "sort --dir-first",                              desc = "Set dir_first sort" },
]

May I know if it is possible to toggle this behavior by one shortcut key?

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Add a --dir-first=toggle option to invert the status between --dir-first=yes and --dir-first=no. Also recommend same change for --reverse / --translit

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