yazi icon indicating copy to clipboard operation
yazi copied to clipboard

Bulk rename not working if YAZI is called from ZSH keybinding

Open uwla opened this issue 7 months ago • 1 comments

What system are you running Yazi on?

Linux X11

What terminal are you running Yazi in?

kitty

yazi --debug output

Yazi
    Version: 0.2.5 (Arch Linux 2024-07-21)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.2.5

Emulator
    Emulator.via_env: ("xterm-256color", "")
    Emulator.via_csi: Ok(Kitty)
    Emulator.detect : Kitty

Adapter
    Adapter.matches: Kitty

Desktop
    XDG_SESSION_TYPE: Some("tty")
    WAYLAND_DISPLAY : None
    DISPLAY         : Some(":0")

SSH
    shared.in_ssh_connection: false

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

Variables
    SHELL              : Some("/bin/zsh")
    EDITOR             : Some("nvim")
    ZELLIJ_SESSION_NAME: None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

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
    Version: 3.4

Dependencies
    file             : 5.45
    ueberzugpp       : No such file or directory (os error 2)
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-35
    fzf              : 0.54.0
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : No such file or directory (os error 2)
    zoxide           : 0.9.4
    unar             : 1.10.7
    jq               : 1.7.1

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

Yes, and I updated the debug information above (yazi --debug) to the nightly that I tried

Describe the bug

It prints the filenames to be renamed but does not renamed them. Here is a demo to illustrate:

yazi_rename_bug

Expected Behavior

It should rename files regardless if it is called from yazi command or from a keybinding.

To Reproduce

Here is the ZSH keybinding:

_yazi() {
  local tmp
  local cwd
  tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
  yazi "$@" --cwd-file="$tmp"
  if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
  	cd -- "$cwd"
  fi
  rm -f -- "$tmp"
  zle reset-prompt;
}

zle -N _yazi
bindkey '^Y' _yazi

Configuration

No response

uwla avatar Jul 22 '24 18:07 uwla