sxyazi / yazi

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

More spacing after icons "Folder:icon()" solution doesn't work as expected #1810

Closed guttermonk closed 5 hours ago

guttermonk commented 5 hours ago

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

kitty 0.34.1, alacritty 0.13.2

yazi --debug output

Yazi
    Version: 0.2.5 (VERGEN_IDEMPOTENT_OUTPUT 1980-01-01)
    OS: linux-x86_64 (unix)
    Debug: false

Emulator
    Emulator.via_env: ("alacritty", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect: Unknown([])

Adaptor
    Adaptor.matches: Wayland

Desktop
    XDG_SESSION_TYPE: Some("wayland")
    WAYLAND_DISPLAY: Some("wayland-1")
    DISPLAY: Some(":0")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL: Some("/run/current-system/sw/bin/bash")
    EDITOR: Some("hx")
    ZELLIJ_SESSION_NAME: None
    YAZI_FILE_ONE: None
    YAZI_CONFIG_HOME: None

file(1)
    Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "file-5.45\nmagic file from /nix/store/1yds8mz9b023mvx65ndsf51v7d0ggpbp-file-5.45/share/misc/magic\n", stderr: "" })

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

tmux
    TMUX: false

Ueberzug++
    Version: Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })

Did you try the latest nightly build to see if the problem got fixed?

No, and I'll explain why below

Describe the bug

Since I can't comment on https://github.com/sxyazi/yazi/issues/297 and https://github.com/sxyazi/yazi/issues/647, I need to open a new issue, but I'm exactly at the same position as discussed there: I'd like more space after the icons.

The problem is that I cannot make the solution provided work with me.

Minimal reproducer

I created a ~/.config/yazi/init.lua file and added the following:

function Folder:icon(file)
    local icon = file:icon()
    return icon and ui.Span(" " .. icon.text .. "  "):style(icon.style) or ui.Span("")
end

Then restarted my terminal and reopened yazi. I get the same behavior in kitty and alacritty.

Anything else?

swappy-2024-10-19-12:42:17

sxyazi commented 5 hours ago

This is expected behavior; Folder has been renamed to Entity since v0.3.0, https://github.com/sxyazi/yazi/issues/1046#issuecomment-2140320472

https://github.com/sxyazi/yazi/blob/24a77d8a5f07f15d3b7d4651c9acf1e372ea5aef/yazi-plugin/preset/components/entity.lua#L17-L26

guttermonk commented 5 hours ago

Since I'm using Version: 0.2.5 (latest version in the NixOS stable repo), shouldn't adding the following to ~/.config/yazi/init.lua work?

function Folder:icon(file)
    local icon = file:icon()
    return icon and ui.Span(" " .. icon.text .. "  "):style(icon.style) or ui.Span("")
end
sxyazi commented 4 hours ago

0.2.5 is a bit too old, and I don't really remember what its API is - if possible, I suggest upgrading to the latest version, 0.3.3, which is available in nix unstable, or Yazi also offers a nix flake for use, https://yazi-rs.github.io/docs/installation#nix-flakes.

Sorry for the inconvenience! Yazi is a new project that's rapidly iterating, and we usually only support the latest version.

guttermonk commented 4 hours ago

I understand. Thank you for the suggestions.

The function in the init.lua should work since your comment here says it's for v0.2.3.

guttermonk commented 1 hour ago

Looking much better with the flake. Thank you! image