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

smoothScroll for yazi #2280

Open
2 of 3 tasks
maarutan opened this issue Feb 3, 2025 · 0 comments
Open
2 of 3 tasks

smoothScroll for yazi #2280

maarutan opened this issue Feb 3, 2025 · 0 comments
Labels
feature New feature request

Comments

@maarutan
Copy link

maarutan commented Feb 3, 2025

yazi --debug output

Yazi
    Version: 0.4.2 (Arch Linux 2025-01-12)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.84.0 (9fc6b431 2025-01-07)

Ya
    Version: 0.4.2 (Arch Linux 2025-01-12)

Emulator
    Brand.from_env      : Some(Kitty)
    Emulator.detect     : Emulator { kind: Left(Kitty), light: false, cell_size: Some((14, 29)) }
    Emulator.detect_full: Ok(Emulator { kind: Left(Kitty), light: false, cell_size: Some((14, 29)) })

Adapter
    Adapter.matches: Kgp

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

NVIM
    NVIM          : false
    Neovim version: 0.10.4

Variables
    SHELL           : Some("/usr/bin/zsh")
    EDITOR          : Some("nvim")
    VISUAL          : Some("nvim")
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: Some("\n--reverse --ansi --no-multi\n--bind=ctrl-u:up,ctrl-e:down,ctrl-n:backward-char,ctrl-i:forward-char,ctrl-b:backward-word,ctrl-h:forward-word\n--border --margin=1,0\n")

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

Multiplexers
    TMUX               : 0
    tmux version       : tmux 3.5a
    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    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.1 / 7.1
    pdftoppm      : No such file or directory (os error 2)
    magick        : 7.1.1-43
    fzf           : 0.57.0
    fd/fdfind     : No such file or directory (os error 2) / No such file or directory (os error 2)
    rg            : 14.1.1
    chafa         : No such file or directory (os error 2)
    zoxide        : 0.9.6
    7z/7zz        : No such file or directory (os error 2) / No such file or directory (os error 2)
    jq            : No such file or directory (os error 2)

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

Please describe the problem you're trying to solve

I'm trying to implement smooth scrolling for <C-d> and <C-u> in Yazi, but I'm facing issues with executing multiple sequential movements.

Current Issue:

  • When I press <C-d>, I want the cursor to gradually move down by executing j multiple times (e.g., 10 steps) instead of instantly jumping.
  • When I press <C-u>, it should gradually move up by executing k multiple times in the same manner.
  • However, when I try to loop through j or k commands, the movement either doesn't happen at all or only executes once instead of performing multiple steps.

What I'm Looking For:

  • A way to sequentially execute multiple key presses (j or k) in Yazi.
  • A non-blocking approach that allows movement to happen over a short duration for a smooth effect.

Is there a proper way to achieve this in Yazi’s plugin system? Would appreciate any guidance on scheduling sequential cursor movements effectively. 🚀

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

I would like <C-d> and <C-u> to smoothly scroll by moving the cursor step by step instead of jumping instantly.

The expected behavior:

  • When pressing <C-d>, the cursor should move down gradually, executing j multiple times (e.g., 10 steps) with a small delay between each step.
  • When pressing <C-u>, the cursor should move up gradually, executing k multiple times in the same manner.

Configurable Options I'd Like:

  1. Scroll limit – Number of steps per scroll (e.g., 10).
  2. Delay per step – A small delay between each j or k press for a smooth animation.

Main Issue:

Currently, executing multiple steps in a loop doesn’t seem to work properly in the sync context. What is the best way to schedule multiple sequential movements in Yazi’s plugin system?

Would love guidance on implementing this correctly! 🚀

Additional context

demo.mp4

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature
@maarutan maarutan added the feature New feature request label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

1 participant