m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

Rename: '--color hidden' to '--color nomatch'

This commit is contained in:
Junegunn Choi
2025-10-03 17:28:24 +09:00
parent 91e119a77e
commit 0df7d10550
6 changed files with 44 additions and 23 deletions

View File

@@ -21,9 +21,30 @@ While non-matching items are displayed in a dimmed color, they are treated just
like matching items, so you place the cursor on them and perform any action. If like matching items, so you place the cursor on them and perform any action. If
you prefer to navigate only through matching items, use the `down-match` and you prefer to navigate only through matching items, use the `down-match` and
`up-match` actions, which are from now on bound to `CTRL-N` and `CTRL-P` `up-match` actions, which are from now on bound to `CTRL-N` and `CTRL-P`
respectively. Historically, these keys were bound to `next-history` and respectively, and also to `ALT-DOWN` and `ALT-UP`.
`prev-history` when `--history` option is enabled, so in that case, you'll need
to manually bind them, or use `ALT-DOWN` and `ALT-UP` instead. | Key | Action | With `--history` |
| :-- | :-- | :-- |
| `down` | `down` | |
| `up` | `up` | |
| `ctrl-j` | `down` | |
| `ctrl-k` | `up` | |
| `ctrl-n` | `down-match` | `next-history` |
| `ctrl-p` | `up-match` | `prev-history` |
| `alt-down` | `down-match` | |
| `alt-up` | `up-match` | |
> [!NOTE]
> `CTRL-N` and `CTRL-P` are bound to `next-history` and `prev-history` when
> `--history` option is enabled, so in that case, you'll need to manually bind
> them, or use `ALT-DOWN` and `ALT-UP` instead.
> [!TIP]
> `up-match` and `down-match` are equivalent to `up` and `down` when not in
> raw mode, so you can safely bind them to `up` and `arrow` keys if you prefer.
> ```sh
> fzf --bind up:up-match,down:down-match
> ```
#### Customizing the look #### Customizing the look
@@ -41,13 +62,13 @@ fzf --bind ctrl-x:toggle-raw --gutter-raw ▎
##### Color and style of non-matching items ##### Color and style of non-matching items
Non-matching items are displayed in a dimmed color by default, but you can Non-matching items are displayed in a dimmed color by default, but you can
change it with the `--color hidden:...` option. change it with the `--color nomatch:...` option.
```sh ```sh
fzf --raw --color hidden:red fzf --raw --color nomatch:red
fzf --raw --color hidden:red:strikethrough fzf --raw --color nomatch:red:dim
fzf --raw --color hidden:red:strikethrough:dim fzf --raw --color nomatch:red:dim:strikethrough
fzf --raw --color hidden:red:strikethrough:dim:italic fzf --raw --color nomatch:red:dim:strikethrough:italic
``` ```
For colored input, dimming alone may not be enough, and you may prefer to remove For colored input, dimming alone may not be enough, and you may prefer to remove
@@ -55,7 +76,7 @@ colors entirely. For that case, a new special style attribute `strip` has been
added. added.
```sh ```sh
fd --color always | fzf --ansi --raw --color hidden:dim:strip:strikethrough fd --color always | fzf --ansi --raw --color nomatch:dim:strip:strikethrough
``` ```
#### Conditional actions for raw mode #### Conditional actions for raw mode

View File

@@ -299,7 +299,7 @@ color mappings. Each entry is separated by a comma and/or whitespaces.
\fBheader (header\-fg) \fRHeader \fBheader (header\-fg) \fRHeader
\fBfooter (footer\-fg) \fRFooter \fBfooter (footer\-fg) \fRFooter
\fBnth \fRParts of the line specified by \fB\-\-nth\fR (only supports attributes) \fBnth \fRParts of the line specified by \fB\-\-nth\fR (only supports attributes)
\fBhidden \fRNon-matching items in raw mode (default: \fBdim\fR) \fBnomatch \fRNon-matching items in raw mode (default: \fBdim\fR)
.B ANSI COLORS: .B ANSI COLORS:
\fB\-1 \fRDefault terminal foreground/background color \fB\-1 \fRDefault terminal foreground/background color

View File

@@ -1455,8 +1455,8 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, *tui
mergeAttr(&theme.SelectedBg) mergeAttr(&theme.SelectedBg)
case "nth": case "nth":
mergeAttr(&theme.Nth) mergeAttr(&theme.Nth)
case "hidden": case "nomatch":
mergeAttr(&theme.Hidden) mergeAttr(&theme.Nomatch)
case "gutter": case "gutter":
mergeAttr(&theme.Gutter) mergeAttr(&theme.Gutter)
case "hl": case "hl":

View File

@@ -256,7 +256,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
base = base.WithAttr(attrNth) base = base.WithAttr(attrNth)
} }
if hidden { if hidden {
base = base.WithFg(theme.Hidden) base = base.WithFg(theme.Nomatch)
} }
color := ansiToColorPair(ansi, base) color := ansiToColorPair(ansi, base)
colors = append(colors, colorOffset{ colors = append(colors, colorOffset{
@@ -267,7 +267,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t
} else { } else {
color := colBase.WithAttr(attrNth) color := colBase.WithAttr(attrNth)
if hidden { if hidden {
color = color.WithFg(theme.Hidden) color = color.WithFg(theme.Nomatch)
} }
colors = append(colors, colorOffset{ colors = append(colors, colorOffset{
offset: [2]int32{int32(start), int32(idx)}, offset: [2]int32{int32(start), int32(idx)},

View File

@@ -3714,7 +3714,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat
if maxWidth > 0 { if maxWidth > 0 {
color := colBase color := colBase
if hidden { if hidden {
color = color.WithFg(t.theme.Hidden) color = color.WithFg(t.theme.Nomatch)
} }
t.printColoredString(t.window, line, offsets, color) t.printColoredString(t.window, line, offsets, color)
} }

View File

@@ -447,7 +447,7 @@ type ColorTheme struct {
ListBg ColorAttr ListBg ColorAttr
AltBg ColorAttr AltBg ColorAttr
Nth ColorAttr Nth ColorAttr
Hidden ColorAttr Nomatch ColorAttr
SelectedFg ColorAttr SelectedFg ColorAttr
SelectedBg ColorAttr SelectedBg ColorAttr
SelectedMatch ColorAttr SelectedMatch ColorAttr
@@ -908,7 +908,7 @@ func init() {
FooterLabel: defaultColor, FooterLabel: defaultColor,
GapLine: defaultColor, GapLine: defaultColor,
Nth: undefined, Nth: undefined,
Hidden: undefined, Nomatch: undefined,
} }
EmptyTheme = &ColorTheme{ EmptyTheme = &ColorTheme{
@@ -958,7 +958,7 @@ func init() {
FooterLabel: undefined, FooterLabel: undefined,
GapLine: undefined, GapLine: undefined,
Nth: undefined, Nth: undefined,
Hidden: undefined, Nomatch: undefined,
} }
Default16 = &ColorTheme{ Default16 = &ColorTheme{
@@ -1008,7 +1008,7 @@ func init() {
FooterLabel: undefined, FooterLabel: undefined,
GapLine: undefined, GapLine: undefined,
Nth: undefined, Nth: undefined,
Hidden: undefined, Nomatch: undefined,
} }
Dark256 = &ColorTheme{ Dark256 = &ColorTheme{
@@ -1058,7 +1058,7 @@ func init() {
FooterLabel: undefined, FooterLabel: undefined,
GapLine: undefined, GapLine: undefined,
Nth: undefined, Nth: undefined,
Hidden: undefined, Nomatch: undefined,
} }
Light256 = &ColorTheme{ Light256 = &ColorTheme{
@@ -1108,7 +1108,7 @@ func init() {
FooterLabel: undefined, FooterLabel: undefined,
GapLine: undefined, GapLine: undefined,
Nth: undefined, Nth: undefined,
Hidden: undefined, Nomatch: undefined,
} }
} }
@@ -1248,8 +1248,8 @@ func InitTheme(theme *ColorTheme, baseTheme *ColorTheme, boldify bool, forceBlac
theme.Spinner = boldify(theme.Spinner) theme.Spinner = boldify(theme.Spinner)
} }
if theme.Hidden.IsUndefined() { if theme.Nomatch.IsUndefined() {
theme.Hidden.Attr = Dim theme.Nomatch.Attr = Dim
} }
initPalette(theme) initPalette(theme)