Skip to content

Color input fields using FZF scheme colors #4331

Open
@hschne

Description

@hschne

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.60.3

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

I'm curious if it's possible to color the FZF prompt of some external command using pre-defined FZF colors. Here's what I mean.

Let's say I have a file with some lines split by spaces. When filtering with FZF I would like the first item to be colored using the list-bg color:

Image

We already have --nth and --with-nth to control search based on fields. It would be interesting to allow users to apply color schema 'tags' to certain fields and color the FZF prompt accordingly. Maybe something like:

# Color the first field text using list-bg and color the second field using hl
--nth-color '1:list-bg,2:hl'

Obviously, this isn't super critical. It's like half feature request and half question if it's possible to achieve something like this by other means. Thank you in advance.

Alternatives considered

When using a custom color scheme I can use --ansi to manually set the color of the first item to the matching color. That's what I'm already doing with a custom history widget.

Image

However, this approach breaks down when users use their own color scheme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions