Skip to content

Searching with ripgrep should highlight the matches in the previewer. #3346

@coolCucumber-cat

Description

@coolCucumber-cat

yazi --debug output

Yazi
    Version: 25.5.31 (20446544 2025-06-05)
    Debug  : false
    Triple : x86_64-pc-windows-msvc (windows-x86_64)
    Rustc  : 1.87.0 (17067e9a 2025-05-09)

Ya
    Version: 25.5.31 (20446544 2025-06-05)

Emulator
    TERM                : None
    TERM_PROGRAM        : None
    TERM_PROGRAM_VERSION: None
    Brand.from_env      : Some(Microsoft)
    Emulator.detect     : Emulator { kind: Left(Microsoft), light: false, csi_16t: (10, 20), force_16t: true }

Adapter
    Adapter.matches    : Sixel
    Dimension.available: Dimension { rows: 51, columns: 209, width: 0, height: 0 }

Desktop
    XDG_SESSION_TYPE           : None
    WAYLAND_DISPLAY            : None
    DISPLAY                    : None
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL           : None
    EDITOR          : None
    VISUAL          : None
    YAZI_FILE_ONE   : Some("C:\\Users\\<user>\\AppData\\Local\\Programs\\Git\\usr\\bin\\file.exe")
    YAZI_CONFIG_HOME: Some("C:\\Users\\<user>\\.config\\yazi")
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: None

Text Opener
    default     : Some(OpenerRule { run: "code %*", block: false, orphan: true, desc: "", for: None, spread: true })
    block-create: None
    block-rename: None

Multiplexers
    TMUX               : false
    tmux version       : program not found
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : program not found

Dependencies
    file          : 5.44
    ueberzugpp    : program not found
    ffmpeg/ffprobe: program not found / program not found
    pdftoppm      : program not found
    magick        : program not found
    fzf           : 0.65.1
    fd/fdfind     : 10.2.0 / program not found
    rg            : 15.1.0
    chafa         : program not found
    zoxide        : program not found
    7zz/7z        : program not found / program not found
    resvg         : program not found
    jq            : program not found

Clipboard
    wl-copy/paste: program not found / program not found
    xclip        : program not found
    xsel         : program not found

Routine
    `file -bL --mime-type`: text/plain

Please describe the problem you're trying to solve

When you use ripgrep/rg to search in files it just shows you matching files but not what is matching. I'm not sure if this is a bug but I have the same problem on Linux and Windows so I'm assuming it just isn't implemented. But not having it makes the feature useless unless it's a really short file.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

  • Maybe the background colour of the matching files can be red to indicate a match.
  • There should also be keybindings to go to the next/previous match.

Other potential improvements:

  • show number of matches in file and which one you are on i.e. "7 of 10".
  • (out of scope) open the file in the code editor and jump to the position of the current match. i.e. VSCode allows you to open a file at a certain position like "code --goto folder/folder2/file.txt:161:10

Additional context

I want to help make this feature, I just might need a little guidance on how to best approach it, but I think I can do it alone.

Checklist

  • I have searched the existing issues/discussions
  • The latest nightly build doesn't already have this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions