Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open yazi and hover a specified file #1610

Closed
3 tasks done
mikavilpas opened this issue Sep 4, 2024 · 3 comments · Fixed by #1979
Closed
3 tasks done

Open yazi and hover a specified file #1610

mikavilpas opened this issue Sep 4, 2024 · 3 comments · Fixed by #1979
Assignees
Labels
feature New feature request

Comments

@mikavilpas
Copy link
Contributor

yazi --debug output

Yazi
    Version: 0.3.3 (7c445ce 2024-09-04)
    Debug  : false
    OS     : macos-aarch64 (unix)

Ya
    Version: 0.3.3 (7c445ce 2024-09-04)

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

Adapter
    Adapter.matches: Iterm2

Desktop
    XDG_SESSION_TYPE           : None
    WAYLAND_DISPLAY            : None
    DISPLAY                    : Some("/private/tmp/com.apple.launchd.NW0SneB39e/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             : Some("nvr --remote-wait")
    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 })

Multiplexers
    TMUX               : false
    tmux version       : tmux 3.3a
    ZELLIJ_SESSION_NAME: None
    Zellij version     : 0.39.2

Dependencies
    file             : 5.41
    ueberzugpp       : 2.9.2
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-33
    fzf              : 0.46.1
    fd               : 9.0.0
    rg               : 14.1.0
    chafa            : 1.14.0
    zoxide           : 0.9.4
    7z               : No such file or directory (os error 2)
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1


--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/Users/mikavilpas/.local/state/yazi" directory.

Please describe the problem you're trying to solve

I would like to improve the Yazi toggle feature of yazi.nvim a bit. This feature remembers where yazi was last closed, the file that was most recently hovered in the previous session. The command simply opens yazi with the hovered path as input.

However, this seems to work nicely for files but for directories the behaviour is slightly different:

  • when a file is given as input (yazi /tmp/file), yazi is opened in /tmp/, hovering file
  • when a directory is given as input (yazi /tmp/), yazi is opened in /tmp/, hovering the first file in that directory
    • in this case, I would like to open yazi in /, hovering /tmp/

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

Here are some ideas:

  1. maybe a new cli argument --hover /tmp/file that would open yazi in /, hovering /tmp/
  • this might be difficult to make work for tabs that are opened at startup (which are given as multiple files, e.g. yazi /tmp/file /etc/ /dev/)
  1. introduce a breaking change to the current behaviour
  • not sure if ideal to make it the default as the current behaviour is sometimes useful
  1. add a new DDS event dds-hover (like dds-cd in https://yazi-rs.github.io/docs/dds/#dds.lua) that is similarly able to hover the specified file

Additional context

No response

Validations

  • I have searched the existing issues
  • The latest nightly build of Yazi doesn't already have this feature
@sxyazi
Copy link
Owner

sxyazi commented Sep 26, 2024

I've been thinking about it, and I think I have an answer now.

We can add a new ya emit subcommand that's just used to trigger built-in commands (instead of DDS events). So ya pub dds-reveal --str "/tmp" could be written as ya emit reveal "/tmp".

Basically, reveal "/tmp" would match the format in keymap.toml for run, meaning we could also use any named parameters, like ya emit plugin --sync "my-plugin".

I'll try to implement it in the next few weeks.

@sxyazi
Copy link
Owner

sxyazi commented Dec 1, 2024

Please try #1979

Copy link

github-actions bot commented Jan 1, 2025

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please file a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature request
Projects
None yet
2 participants