sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
17.09k stars 399 forks source link

Use data folder to store flavors and plugins #1970

Closed dangooddd closed 5 days ago

dangooddd commented 5 days ago

yazi --debug output

Yazi
    Version: 0.3.3 (37292adf 2024-11-29)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.83.0 (90b35a62 2024-11-26)

Ya
    Version: 0.3.3 (37292adf 2024-11-29)

Emulator
    Brand.from_env      : None
    Emulator.detect     : Emulator { kind: Right(Unknown { kgp: false, sixel: false }), light: false }
    Emulator.detect_full: Ok(Emulator { kind: Right(Unknown { kgp: false, sixel: false }), light: false })

Adapter
    Adapter.matches: Chafa

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-0")
    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/bash")
    EDITOR          : Some("nvim")
    VISUAL          : Some("nvim")
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: Some("--layout=reverse                          --height 10                          --ansi                          --border=sharp")

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

Multiplexers
    TMUX               : false
    tmux version       : tmux 3.5a
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : 0.40.1

Dependencies
    file          : 5.45
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.0.2 / 7.0.2
    pdftoppm      : 24.08.0
    magick        : 7.1.1-39
    fzf           : 0.56.3
    fd/fdfind     : 10.1.0 / No such file or directory (os error 2)
    rg            : 14.1.1
    chafa         : 1.14.5
    zoxide        : 0.9.4
    7z/7zz        : 16.02 / No such file or directory (os error 2)
    jq            : 1.7.1

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

Please describe the problem you're trying to solve

Currently flavors and plugins stored at config directory. In my opinion these type of data should be stored at data folder (~/.local/share/yazi or $XDG_CONFIG_HOME/yazi). Is there any good reason to store that in config folder? For example nvim stores plugins in data folder.

Also some people don't want to store source code of plugins and flavors with licenses in their dotfiles repos. It will be more consistent to not add anything like that in .gitignore file

Would you be willing to contribute this feature?

Describe the solution you'd like

Add option to ya pack to install plugins and flavors in data folder instead of config folder or make it default behavior

Additional context

No response

Validations

sxyazi commented 5 days ago

Duplicate of https://github.com/sxyazi/yazi/issues/1408

I want to keep it simple – it's just about automating the step of manually downloading plugins from GitHub.

Since it supports monorepos, supporting that would require introducing a third directory, which makes the design and implementation more complex. It also breaks the convention of the plugin directory location, because plugins would come from two directories, which introduces the need for a separate priority concept – which plugin should be used when two directories have a plugin with the same name?

This increases confusion while reducing transparency for users – it's easy for me to know where Yazi's config directory is, but it's hard to say where the data directory storing plugins is, which makes it harder for users to find their plugins.

Also, since plugins could come from two directories, every time we load plugins, an extra check is needed, which affects performance. Plus, it would break other features in Yazi, like the YAZI_CONFIG_PATH environment variable. These issues are also present in flavor.

I've provided a more detailed explanation in the linked issue, please read it. Closing as duplicate and not planned.