diff --git a/CHANGELOG.md b/CHANGELOG.md index a30bdbeb..41c84630 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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` -respectively. Historically, these keys were 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. +respectively, and also to `ALT-DOWN` and `ALT-UP`. + +| 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 @@ -41,13 +62,13 @@ fzf --bind ctrl-x:toggle-raw --gutter-raw ▎ ##### Color and style of non-matching items 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 -fzf --raw --color hidden:red -fzf --raw --color hidden:red:strikethrough -fzf --raw --color hidden:red:strikethrough:dim -fzf --raw --color hidden:red:strikethrough:dim:italic +fzf --raw --color nomatch:red +fzf --raw --color nomatch:red:dim +fzf --raw --color nomatch:red:dim:strikethrough +fzf --raw --color nomatch:red:dim:strikethrough:italic ``` 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. ```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 diff --git a/man/man1/fzf.1 b/man/man1/fzf.1 index 4be02c97..bf26d377 100644 --- a/man/man1/fzf.1 +++ b/man/man1/fzf.1 @@ -299,7 +299,7 @@ color mappings. Each entry is separated by a comma and/or whitespaces. \fBheader (header\-fg) \fRHeader \fBfooter (footer\-fg) \fRFooter \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: \fB\-1 \fRDefault terminal foreground/background color diff --git a/src/options.go b/src/options.go index aa50dc54..c2fc562d 100644 --- a/src/options.go +++ b/src/options.go @@ -1455,8 +1455,8 @@ func parseTheme(defaultTheme *tui.ColorTheme, str string) (*tui.ColorTheme, *tui mergeAttr(&theme.SelectedBg) case "nth": mergeAttr(&theme.Nth) - case "hidden": - mergeAttr(&theme.Hidden) + case "nomatch": + mergeAttr(&theme.Nomatch) case "gutter": mergeAttr(&theme.Gutter) case "hl": diff --git a/src/result.go b/src/result.go index d6811dc8..4ba4bd2c 100644 --- a/src/result.go +++ b/src/result.go @@ -256,7 +256,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t base = base.WithAttr(attrNth) } if hidden { - base = base.WithFg(theme.Hidden) + base = base.WithFg(theme.Nomatch) } color := ansiToColorPair(ansi, base) colors = append(colors, colorOffset{ @@ -267,7 +267,7 @@ func (result *Result) colorOffsets(matchOffsets []Offset, nthOffsets []Offset, t } else { color := colBase.WithAttr(attrNth) if hidden { - color = color.WithFg(theme.Hidden) + color = color.WithFg(theme.Nomatch) } colors = append(colors, colorOffset{ offset: [2]int32{int32(start), int32(idx)}, diff --git a/src/terminal.go b/src/terminal.go index b91687cb..f8899fd8 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -3714,7 +3714,7 @@ func (t *Terminal) printHighlighted(result Result, colBase tui.ColorPair, colMat if maxWidth > 0 { color := colBase if hidden { - color = color.WithFg(t.theme.Hidden) + color = color.WithFg(t.theme.Nomatch) } t.printColoredString(t.window, line, offsets, color) } diff --git a/src/tui/tui.go b/src/tui/tui.go index 33fb626f..ca3d5531 100644 --- a/src/tui/tui.go +++ b/src/tui/tui.go @@ -447,7 +447,7 @@ type ColorTheme struct { ListBg ColorAttr AltBg ColorAttr Nth ColorAttr - Hidden ColorAttr + Nomatch ColorAttr SelectedFg ColorAttr SelectedBg ColorAttr SelectedMatch ColorAttr @@ -908,7 +908,7 @@ func init() { FooterLabel: defaultColor, GapLine: defaultColor, Nth: undefined, - Hidden: undefined, + Nomatch: undefined, } EmptyTheme = &ColorTheme{ @@ -958,7 +958,7 @@ func init() { FooterLabel: undefined, GapLine: undefined, Nth: undefined, - Hidden: undefined, + Nomatch: undefined, } Default16 = &ColorTheme{ @@ -1008,7 +1008,7 @@ func init() { FooterLabel: undefined, GapLine: undefined, Nth: undefined, - Hidden: undefined, + Nomatch: undefined, } Dark256 = &ColorTheme{ @@ -1058,7 +1058,7 @@ func init() { FooterLabel: undefined, GapLine: undefined, Nth: undefined, - Hidden: undefined, + Nomatch: undefined, } Light256 = &ColorTheme{ @@ -1108,7 +1108,7 @@ func init() { FooterLabel: undefined, GapLine: 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) } - if theme.Hidden.IsUndefined() { - theme.Hidden.Attr = Dim + if theme.Nomatch.IsUndefined() { + theme.Nomatch.Attr = Dim } initPalette(theme)