From 689559b7dbf1b90124909a4c47de3d384b9fa61b Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 18:17:44 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 + README.md | 3 + SKILL.md | 449 +++++++++++++++++++++++++++++++++++++ plugin.lock.json | 57 +++++ references/actions.md | 412 ++++++++++++++++++++++++++++++++++ references/integrations.md | 447 ++++++++++++++++++++++++++++++++++++ references/options.md | 409 +++++++++++++++++++++++++++++++++ 7 files changed, 1788 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 SKILL.md create mode 100644 plugin.lock.json create mode 100644 references/actions.md create mode 100644 references/integrations.md create mode 100644 references/options.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..92962af --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "fzf", + "description": "Command-line fuzzy finder for interactive filtering. Use when searching files, command history (CTRL-R), creating interactive menus, or integrating with ripgrep, fd, and git. Triggers on fzf, fuzzy finder, ** completion, or CTRL-T/CTRL-R/ALT-C keybindings.", + "version": "1.0.0", + "author": { + "name": "Alberto Leal" + }, + "skills": [ + "./" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e8178ee --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# fzf + +Command-line fuzzy finder for interactive filtering. Use when searching files, command history (CTRL-R), creating interactive menus, or integrating with ripgrep, fd, and git. Triggers on fzf, fuzzy finder, ** completion, or CTRL-T/CTRL-R/ALT-C keybindings. diff --git a/SKILL.md b/SKILL.md new file mode 100644 index 0000000..87aa95c --- /dev/null +++ b/SKILL.md @@ -0,0 +1,449 @@ +--- +name: fzf +description: Command-line fuzzy finder for interactive filtering of any list. Use when interactively selecting files, searching command history (CTRL-R), creating selection interfaces in scripts, building interactive menus, or integrating fuzzy search with tools like ripgrep, fd, and git. Triggers on mentions of fzf, fuzzy finder, ** completion, interactive filtering, or shell keybindings CTRL-T/CTRL-R/ALT-C. +--- + +# fzf - Command-Line Fuzzy Finder + +## Overview + +fzf is a general-purpose command-line fuzzy finder. It reads a list of items from STDIN, allows interactive selection using fuzzy matching, and outputs the selected item(s) to STDOUT. Think of it as an interactive grep. + +**Key characteristics:** +- **Fast**: Processes millions of items instantly +- **Portable**: Single binary, works everywhere +- **Versatile**: Customizable via event-action binding mechanism +- **Integrated**: Built-in shell integrations for bash, zsh, and fish + +## When to Use This Skill + +Use fzf when: +- **Selecting files interactively**: `vim $(fzf)` or fuzzy completion with `**` +- **Searching command history**: CTRL-R for fuzzy history search +- **Navigating directories**: ALT-C to cd into selected directory +- **Building interactive scripts**: Create selection menus for any list +- **Filtering output**: Pipe any command output through fzf +- **Integrating with other tools**: ripgrep, fd, git, etc. + +## Prerequisites + +**CRITICAL**: Before proceeding, you MUST verify that fzf is installed: + +```bash +fzf --version +``` + +**If fzf is not installed:** +- **DO NOT** attempt to install it automatically +- **STOP** and inform the user that fzf is required +- **RECOMMEND** manual installation with the following instructions: + +```bash +# macOS +brew install fzf + +# Debian/Ubuntu +sudo apt install fzf + +# Arch Linux +sudo pacman -S fzf + +# From source +git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf +~/.fzf/install + +# Other systems: see https://github.com/junegunn/fzf#installation +``` + +**If fzf is not available, exit gracefully and do not proceed with the workflow below.** + +## Shell Integration + +fzf provides shell integration that enables powerful keybindings (CTRL-T, CTRL-R, ALT-C) and fuzzy completion (`**`). These features require the user to configure their shell. + +**Note:** Shell integration setup is the user's responsibility. If keybindings don't work, **RECOMMEND** the user add the appropriate line to their shell config: + +```bash +# Bash (~/.bashrc) +eval "$(fzf --bash)" + +# Zsh (~/.zshrc) +source <(fzf --zsh) + +# Fish (~/.config/fish/config.fish) +fzf --fish | source +``` + +### Key Bindings (requires shell integration) + +| Key | Function | Description | +|-----|----------|-------------| +| `CTRL-T` | File selection | Paste selected files/directories onto command line | +| `CTRL-R` | History search | Fuzzy search command history | +| `ALT-C` | Directory jump | cd into selected directory | + +**CTRL-R extras:** +- Press `CTRL-R` again to toggle sort by relevance +- Press `ALT-R` to toggle raw mode (see surrounding items) +- Press `CTRL-/` or `ALT-/` to toggle line wrapping + +### Fuzzy Completion (`**`) + +Trigger fuzzy completion with `**` followed by TAB: + +```bash +# Files under current directory +vim ** + +# Files under specific directory +vim ../fzf** + +# Directories only +cd ** + +# Process IDs (for kill) +kill -9 ** + +# SSH hostnames +ssh ** + +# Environment variables +export ** +``` + +## Search Syntax + +fzf uses extended-search mode by default. Multiple search terms are separated by spaces. + +| Token | Match Type | Description | +|-------|------------|-------------| +| `sbtrkt` | Fuzzy match | Items matching `sbtrkt` | +| `'wild` | Exact match | Items containing `wild` exactly | +| `'wild'` | Exact boundary | Items with `wild` at word boundaries | +| `^music` | Prefix match | Items starting with `music` | +| `.mp3$` | Suffix match | Items ending with `.mp3` | +| `!fire` | Inverse match | Items NOT containing `fire` | +| `!^music` | Inverse prefix | Items NOT starting with `music` | +| `!.mp3$` | Inverse suffix | Items NOT ending with `.mp3` | + +**OR operator**: Use `|` to match any of several patterns: +```bash +# Files starting with 'core' and ending with go, rb, or py +^core go$ | rb$ | py$ +``` + +**Escape spaces**: Use `\ ` to match literal space characters. + +## Basic Usage + +### Simple Selection + +```bash +# Select a file and open in vim +vim $(fzf) + +# Safer with xargs (handles spaces, cancellation) +fzf --print0 | xargs -0 -o vim + +# Using become() action (best approach) +fzf --bind 'enter:become(vim {})' +``` + +### Multi-Select + +```bash +# Enable multi-select with -m +fzf -m + +# Select with TAB, deselect with Shift-TAB +# Selected items printed on separate lines +``` + +### Preview Window + +```bash +# Basic preview +fzf --preview 'cat {}' + +# With syntax highlighting (requires bat) +fzf --preview 'bat --color=always {}' + +# Customize preview window position/size +fzf --preview 'cat {}' --preview-window=right,50% +fzf --preview 'cat {}' --preview-window=up,40%,border-bottom +``` + +## Display Modes + +### Height Mode + +```bash +# Use 40% of terminal height +fzf --height 40% + +# Adaptive height (shrinks for small lists) +seq 5 | fzf --height ~100% + +# With layout options +fzf --height 40% --layout reverse --border +``` + +### tmux Mode + +```bash +# Open in tmux popup (requires tmux 3.3+) +fzf --tmux center # Center, 50% width/height +fzf --tmux 80% # Center, 80% width/height +fzf --tmux left,40% # Left side, 40% width +fzf --tmux bottom,30% # Bottom, 30% height +``` + +## Essential Options + +### Layout and Appearance + +```bash +--height=HEIGHT[%] # Non-fullscreen mode +--layout=reverse # Display from top (default: bottom) +--border[=STYLE] # rounded, sharp, bold, double, block +--margin=MARGIN # Margin around finder +--padding=PADDING # Padding inside border +--info=STYLE # default, inline, hidden +``` + +### Search Behavior + +```bash +-e, --exact # Exact match (disable fuzzy) +-i # Case-insensitive ++i # Case-sensitive +--scheme=SCHEME # default, path, history +--algo=TYPE # v2 (quality), v1 (performance) +``` + +### Input/Output + +```bash +-m, --multi # Enable multi-select +--read0 # Read NUL-delimited input +--print0 # Print NUL-delimited output +--ansi # Enable ANSI color processing +``` + +### Field Processing + +```bash +--delimiter=STR # Field delimiter (default: AWK-style) +--nth=N[,..] # Limit search to specific fields +--with-nth=N[,..] # Transform display of each line +``` + +## Event Bindings + +Customize behavior with `--bind`: + +```bash +# Basic syntax +fzf --bind 'KEY:ACTION' +fzf --bind 'EVENT:ACTION' +fzf --bind 'KEY:ACTION1+ACTION2' # Chain actions + +# Examples +fzf --bind 'ctrl-a:select-all' +fzf --bind 'ctrl-d:deselect-all' +fzf --bind 'ctrl-/:toggle-preview' +fzf --bind 'enter:become(vim {})' +``` + +### Key Actions (Selection) + +| Action | Description | +|--------|-------------| +| `accept` | Accept current selection | +| `abort` | Abort and exit | +| `toggle` | Toggle selection of current item | +| `select-all` | Select all matches | +| `deselect-all` | Deselect all | +| `toggle-all` | Toggle all selections | + +### Useful Actions + +| Action | Description | +|--------|-------------| +| `reload(cmd)` | Reload list from command | +| `become(cmd)` | Replace fzf with command | +| `execute(cmd)` | Run command, return to fzf | +| `execute-silent(cmd)` | Run command silently | +| `preview(cmd)` | Change preview command | +| `toggle-preview` | Show/hide preview | +| `change-prompt(str)` | Change prompt string | + +### Events + +| Event | Triggered When | +|-------|----------------| +| `start` | fzf starts | +| `load` | Input loading completes | +| `change` | Query string changes | +| `focus` | Focused item changes | +| `result` | Result list updates | + +For complete action reference, see [references/actions.md](references/actions.md). + +## Environment Variables + +### Core Configuration + +```bash +# Default command when input is TTY +export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' + +# Default options (applied to all fzf invocations) +export FZF_DEFAULT_OPTS='--height 40% --layout reverse --border' + +# Options file (alternative to FZF_DEFAULT_OPTS) +export FZF_DEFAULT_OPTS_FILE=~/.fzfrc +``` + +### Shell Integration Variables + +```bash +# CTRL-T options +export FZF_CTRL_T_COMMAND="fd --type f" +export FZF_CTRL_T_OPTS="--preview 'bat --color=always {}'" + +# CTRL-R options +export FZF_CTRL_R_OPTS="--bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'" + +# ALT-C options +export FZF_ALT_C_COMMAND="fd --type d" +export FZF_ALT_C_OPTS="--preview 'tree -C {}'" +``` + +### Completion Customization + +```bash +# Change trigger sequence (default: **) +export FZF_COMPLETION_TRIGGER='~~' + +# Completion options +export FZF_COMPLETION_OPTS='--border --info=inline' +``` + +## Common Patterns + +### Find and Edit Files + +```bash +# Using fd for better performance +fd --type f | fzf --preview 'bat --color=always {}' | xargs -o vim + +# Or with become() +fd --type f | fzf --preview 'bat --color=always {}' --bind 'enter:become(vim {})' +``` + +### Search File Contents (with ripgrep) + +```bash +# Basic ripgrep integration +rg --line-number . | fzf --delimiter : --preview 'bat --color=always {1} --highlight-line {2}' + +# Open result in vim at line +rg --line-number . | fzf --delimiter : --bind 'enter:become(vim {1} +{2})' +``` + +### Git Integration + +```bash +# Select git branch +git branch | fzf | xargs git checkout + +# Select commit +git log --oneline | fzf --preview 'git show {1}' | cut -d' ' -f1 + +# Stage files interactively +git status -s | fzf -m | awk '{print $2}' | xargs git add +``` + +### Dynamic List Reloading + +```bash +# Reload process list with CTRL-R +ps -ef | fzf --bind 'ctrl-r:reload(ps -ef)' --header 'Press CTRL-R to reload' + +# Toggle between files and directories +fd | fzf --bind 'ctrl-d:reload(fd --type d)' --bind 'ctrl-f:reload(fd --type f)' +``` + +### Interactive ripgrep Launcher + +```bash +# fzf as ripgrep frontend (search updates on typing) +RG_PREFIX="rg --column --line-number --no-heading --color=always" +fzf --ansi --disabled \ + --bind "start:reload:$RG_PREFIX ''" \ + --bind "change:reload:$RG_PREFIX {q} || true" \ + --bind 'enter:become(vim {1} +{2})' \ + --delimiter : +``` + +## Placeholders + +Use in `--preview`, `--bind`, etc.: + +| Placeholder | Description | +|-------------|-------------| +| `{}` | Current selection (quoted) | +| `{+}` | All selected items (space-separated) | +| `{q}` | Current query string | +| `{n}` | Zero-based index of current item | +| `{1}`, `{2}`, etc. | Nth field (with --delimiter) | +| `{-1}` | Last field | +| `{1..3}` | Fields 1 through 3 | +| `{2..}` | Fields 2 to end | + +**Flags:** +- `{+}` - All selected items +- `{f}` - Write to temp file (for large lists) +- `{r}` - Raw (unquoted) output + +## Advanced Topics + +For detailed documentation on advanced features, see: + +- [references/actions.md](references/actions.md) - Complete list of bindable actions +- [references/options.md](references/options.md) - Full options reference +- [references/integrations.md](references/integrations.md) - ripgrep, fd, git, bat integrations + +## Troubleshooting + +**"Command not found: fzf"** +- fzf is not installed. See Prerequisites section for manual installation instructions +- Do NOT attempt automatic installation + +**Shell keybindings not working (CTRL-T, CTRL-R, ALT-C):** +- Shell integration must be configured by the user +- RECOMMEND adding the appropriate line to shell config (see Shell Integration section) +- For bash, must be sourced after any PS1 modifications + +**Performance issues:** +- Avoid `--ansi` in `FZF_DEFAULT_OPTS` (slows initial scan) +- Use `--nth` sparingly (requires tokenization) +- Prefer string `--delimiter` over regex + +**Preview not showing:** +- Check preview command syntax +- Use `{}` placeholder for current selection +- Test preview command manually first + +**CTRL-R not finding old commands:** +- fzf searches shell history, not history file +- Increase `HISTSIZE` and `HISTFILESIZE` + +## Resources + +- **Man page**: `man fzf` or `fzf --man` +- **Wiki examples**: https://github.com/junegunn/fzf/wiki/examples +- **Advanced examples**: https://github.com/junegunn/fzf/blob/master/ADVANCED.md +- **Theme playground**: https://vitormv.github.io/fzf-themes/ +- **fzf-git.sh**: https://github.com/junegunn/fzf-git.sh (git keybindings) diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..80c21ae --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,57 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:dashed/claude-marketplace:plugins/fzf", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "19d09c0ac77a035ef86accb51f479e1f79a798f1", + "treeHash": "734c6a36c82e30dd42b5b26ab742bead7eb77d7ffdcfd1ed3a51acf0aa679253", + "generatedAt": "2025-11-28T10:16:06.458102Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "fzf", + "description": "Command-line fuzzy finder for interactive filtering. Use when searching files, command history (CTRL-R), creating interactive menus, or integrating with ripgrep, fd, and git. Triggers on fzf, fuzzy finder, ** completion, or CTRL-T/CTRL-R/ALT-C keybindings.", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "aba2a58b790c86ebc5a1f128fe302f15b42fbc1450262b4fb0bbdac687cc32c4" + }, + { + "path": "SKILL.md", + "sha256": "9a400961b6a22397abc776321472f82d7163472009d587170d83d62daee10032" + }, + { + "path": "references/integrations.md", + "sha256": "80c3f4827a7fe3d896287d3967b15dc59d43c49f8cb2746aafc049e5c9bd4185" + }, + { + "path": "references/options.md", + "sha256": "eabb038ec6ec3e764c5edaa18f20a10fc330dbbbf5c5448e1de0e402aec70751" + }, + { + "path": "references/actions.md", + "sha256": "c6c6638106dd6a2dd74a5e2b0ab268aca3e86b80e6589b9c0d31377cb4415856" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "e5f0bd5cce1dc589bef5e3beb4f06c34456c59ba7dc5781430a1aa10d74ed3af" + } + ], + "dirSha256": "734c6a36c82e30dd42b5b26ab742bead7eb77d7ffdcfd1ed3a51acf0aa679253" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/references/actions.md b/references/actions.md new file mode 100644 index 0000000..2c6760a --- /dev/null +++ b/references/actions.md @@ -0,0 +1,412 @@ +# fzf Actions Reference + +Complete reference for all bindable actions in fzf. + +## Table of Contents + +- [Action Syntax](#action-syntax) +- [Selection Actions](#selection-actions) +- [Cursor Movement](#cursor-movement) +- [Preview Actions](#preview-actions) +- [Query Actions](#query-actions) +- [Multi-Select Actions](#multi-select-actions) +- [Display Actions](#display-actions) +- [Command Execution](#command-execution) +- [Transform Actions](#transform-actions) +- [Events](#events) + +## Action Syntax + +### Basic Binding + +```bash +fzf --bind 'KEY:ACTION' +fzf --bind 'EVENT:ACTION' +``` + +### Chaining Actions + +```bash +# Use + to chain multiple actions +fzf --bind 'ctrl-a:select-all+accept' +fzf --bind 'ctrl-a:select-all' --bind 'ctrl-a:+accept' +``` + +### Action Arguments + +```bash +fzf --bind 'ctrl-a:change-prompt(NewPrompt> )' +fzf --bind 'ctrl-v:preview(cat {})' +``` + +Alternative delimiters for arguments with parentheses: + +```bash +action-name[...] action-name{...} action-name<...> +action-name~...~ action-name!...! action-name@...@ +action-name#...# action-name$...$ action-name%...% +action-name^...^ action-name&...& action-name*...* +action-name;...; action-name/.../ action-name|...| +action-name:... # Special: no closing char needed (must be last) +``` + +## Selection Actions + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `accept` | `enter`, `double-click` | Accept current selection and exit | +| `accept-non-empty` | - | Accept only if selection is not empty | +| `accept-or-print-query` | - | Accept, or print query if no match | +| `abort` | `ctrl-c`, `ctrl-g`, `ctrl-q`, `esc` | Abort and exit | +| `cancel` | - | Clear query if not empty, abort otherwise | +| `close` | - | Close preview if open, abort otherwise | + +## Cursor Movement + +### Basic Movement + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `up` | `ctrl-k`, `up` | Move cursor up | +| `down` | `ctrl-j`, `down` | Move cursor down | +| `first` | - | Move to first match | +| `last` | - | Move to last match | +| `best` | - | Move to best match | +| `pos(N)` | - | Move to position N (negative counts from end) | + +### Match Navigation + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `up-match` | `ctrl-p`, `alt-up` | Move to match above cursor | +| `down-match` | `ctrl-n`, `alt-down` | Move to match below cursor | +| `up-selected` | - | Move to selected item above | +| `down-selected` | - | Move to selected item below | + +### Page Movement + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `page-up` | `pgup` | Page up | +| `page-down` | `pgdn` | Page down | +| `half-page-up` | - | Half page up | +| `half-page-down` | - | Half page down | +| `offset-up` | - | Scroll view up (like Vim's CTRL-Y) | +| `offset-down` | - | Scroll view down (like Vim's CTRL-E) | +| `offset-middle` | - | Center current item in view | + +## Preview Actions + +### Preview Control + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `toggle-preview` | - | Show/hide preview window | +| `show-preview` | - | Show preview window | +| `hide-preview` | - | Hide preview window | +| `refresh-preview` | - | Refresh preview content | +| `preview(cmd)` | - | Execute preview command | + +### Preview Navigation + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `preview-up` | `shift-up` | Scroll preview up | +| `preview-down` | `shift-down` | Scroll preview down | +| `preview-page-up` | - | Preview page up | +| `preview-page-down` | - | Preview page down | +| `preview-half-page-up` | - | Preview half page up | +| `preview-half-page-down` | - | Preview half page down | +| `preview-top` | - | Scroll to preview top | +| `preview-bottom` | - | Scroll to preview bottom | +| `toggle-preview-wrap` | - | Toggle line wrap in preview | + +### Preview Window Options + +| Action | Description | +|--------|-------------| +| `change-preview(cmd)` | Change preview command | +| `change-preview-window(opts)` | Change preview window options | +| `change-preview-label(str)` | Change preview label | +| `transform-preview-label(cmd)` | Transform label with command output | + +## Query Actions + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `clear-query` | - | Clear query string | +| `change-query(str)` | - | Set query to string | +| `replace-query` | - | Replace query with current selection | +| `transform-query(cmd)` | - | Transform query with command output | +| `search(str)` | - | Trigger fzf search with string | +| `transform-search(cmd)` | - | Search with command output | + +### Line Editing + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `backward-char` | `ctrl-b`, `left` | Move cursor left | +| `forward-char` | `ctrl-f`, `right` | Move cursor right | +| `backward-word` | `alt-b`, `shift-left` | Move to previous word | +| `forward-word` | `alt-f`, `shift-right` | Move to next word | +| `beginning-of-line` | `ctrl-a`, `home` | Move to line start | +| `end-of-line` | `ctrl-e`, `end` | Move to line end | +| `backward-delete-char` | `ctrl-h`, `bspace` | Delete char before cursor | +| `delete-char` | `del` | Delete char at cursor | +| `backward-kill-word` | `alt-bs` | Delete word before cursor | +| `kill-word` | `alt-d` | Delete word after cursor | +| `kill-line` | - | Delete to end of line | +| `unix-line-discard` | `ctrl-u` | Delete entire line | +| `unix-word-rubout` | `ctrl-w` | Delete word (Unix style) | +| `yank` | `ctrl-y` | Paste killed text | +| `put(str)` | - | Insert string at cursor | + +## Multi-Select Actions + +| Action | Default Binding | Description | +|--------|-----------------|-------------| +| `toggle` | `right-click` | Toggle selection of current item | +| `toggle+up` | `shift-tab` | Toggle and move up | +| `toggle+down` | `tab` | Toggle and move down | +| `toggle-in` | - | Toggle based on layout direction | +| `toggle-out` | - | Toggle based on layout direction | +| `select` | - | Select current item | +| `deselect` | - | Deselect current item | +| `select-all` | - | Select all matches | +| `deselect-all` | - | Deselect all matches | +| `toggle-all` | - | Toggle all matches | +| `clear-multi` | - | Clear all selections | +| `change-multi` | - | Enable multi-select with no limit | +| `change-multi(N)` | - | Enable with limit N (0 to disable) | + +## Display Actions + +### UI Elements + +| Action | Description | +|--------|-------------| +| `change-prompt(str)` | Change prompt text | +| `transform-prompt(cmd)` | Transform prompt with command | +| `change-header(str)` | Change header text | +| `transform-header(cmd)` | Transform header with command | +| `change-border-label(str)` | Change border label | +| `transform-border-label(cmd)` | Transform border label | +| `change-list-label(str)` | Change list label | +| `change-input-label(str)` | Change input label | +| `change-header-label(str)` | Change header label | +| `change-ghost(str)` | Change ghost text | +| `change-pointer(str)` | Change pointer character | +| `change-nth(expr)` | Change --nth option | + +### Visibility Toggles + +| Action | Description | +|--------|-------------| +| `toggle-header` | Toggle header visibility | +| `show-header` | Show header | +| `hide-header` | Hide header | +| `toggle-input` | Toggle input visibility | +| `show-input` | Show input | +| `hide-input` | Hide input | +| `clear-screen` | Clear and redraw screen | + +### Behavior Toggles + +| Action | Description | +|--------|-------------| +| `toggle-sort` | Toggle sorting | +| `toggle-search` | Toggle search functionality | +| `enable-search` | Enable search | +| `disable-search` | Disable search | +| `toggle-wrap` | Toggle line wrap | +| `toggle-hscroll` | Toggle horizontal scroll | +| `toggle-track` | Toggle global tracking | +| `track-current` | Track current item | +| `toggle-track-current` | Toggle tracking current item | +| `toggle-raw` | Toggle raw mode | +| `enable-raw` | Enable raw mode | +| `disable-raw` | Disable raw mode | +| `toggle-multi-line` | Toggle multi-line display | + +## Command Execution + +### execute() + +Run command without leaving fzf: + +```bash +fzf --bind 'enter:execute(less {})' +fzf --bind 'ctrl-e:execute(vim {} < /dev/tty > /dev/tty)' +``` + +### execute-silent() + +Run command silently (no screen switch): + +```bash +fzf --bind 'ctrl-y:execute-silent(echo {} | pbcopy)' +``` + +### become() + +Replace fzf with command (using execve): + +```bash +fzf --bind 'enter:become(vim {})' +fzf --bind 'enter:become(vim {1} +{2})' # With field expressions +``` + +**Advantages over `$(fzf)`:** +- No empty file opened on CTRL-C +- No empty file on enter with no results +- Handles multiple selections with spaces + +### reload() + +Dynamically update input list: + +```bash +fzf --bind 'ctrl-r:reload(ps -ef)' +fzf --bind 'change:reload(rg --line-number {q} || true)' +``` + +### reload-sync() + +Synchronous reload (waits for command completion): + +```bash +fzf --bind 'load:reload-sync(slow-command)+unbind(load)' +``` + +### print() + +Add to output queue (printed on normal exit): + +```bash +fzf --bind 'ctrl-y:print(selected)+accept' +``` + +## Transform Actions + +Transform actions run external commands and use output to modify state. + +### Basic Transform + +```bash +# Transform header based on focused item +fzf --bind 'focus:transform-header:file --brief {}' + +# Conditional actions +fzf --bind 'enter:transform:[[ -n {} ]] && echo accept || echo abort' +``` + +### Transform Actions List + +| Action | Description | +|--------|-------------| +| `transform(cmd)` | Run cmd, output is action sequence | +| `transform-query(cmd)` | Set query to command output | +| `transform-prompt(cmd)` | Set prompt to command output | +| `transform-header(cmd)` | Set header to command output | +| `transform-border-label(cmd)` | Set border label | +| `transform-preview-label(cmd)` | Set preview label | +| `transform-list-label(cmd)` | Set list label | +| `transform-input-label(cmd)` | Set input label | +| `transform-header-label(cmd)` | Set header label | +| `transform-ghost(cmd)` | Set ghost text | +| `transform-pointer(cmd)` | Set pointer | +| `transform-nth(cmd)` | Set nth option | +| `transform-search(cmd)` | Trigger search with output | + +### Background Transform + +Each transform has a `bg-transform*` variant for async execution: + +```bash +# Won't block UI +fzf --bind 'focus:bg-transform-header:slow-command {}' + +# Cancel running background transforms +fzf --bind 'ctrl-c:bg-cancel' +``` + +## Binding Management + +| Action | Description | +|--------|-------------| +| `unbind(keys)` | Unbind specified keys/events | +| `rebind(keys)` | Rebind previously unbound keys | +| `toggle-bind` | Toggle all custom bindings | +| `trigger(keys)` | Trigger actions bound to keys | + +Example: Mode switching + +```bash +fzf --bind 'ctrl-f:unbind(change)+enable-search+rebind(ctrl-r)' \ + --bind 'ctrl-r:unbind(ctrl-r)+disable-search+reload(cmd)+rebind(change)' +``` + +## Events + +Events trigger actions automatically based on state changes. + +| Event | Triggered When | +|-------|----------------| +| `start` | fzf starts (list may not be ready) | +| `load` | Input stream complete, initial processing done | +| `change` | Query string changes | +| `focus` | Focused item changes | +| `result` | Result list updates | +| `resize` | Terminal size changes | +| `one` | Exactly one match | +| `zero` | No matches | +| `multi` | Multi-selection changes | +| `backward-eof` | Backspace on empty query | +| `jump` | Successfully jumped in jump mode | +| `jump-cancel` | Jump mode cancelled | +| `click-header` | Mouse click in header | +| `click-footer` | Mouse click in footer | + +### Event Examples + +```bash +# Auto-accept single match +fzf --bind 'one:accept' + +# Reload on empty results +fzf --bind 'zero:reload(alternative-cmd)' + +# Update header on focus change +fzf --bind 'focus:transform-header:file --brief {}' + +# Initialize after load +fzf --sync --bind 'load:select-all' +``` + +## Miscellaneous Actions + +| Action | Description | +|--------|-------------| +| `ignore` | Do nothing | +| `bell` | Ring terminal bell | +| `jump` | EasyMotion-like 2-keystroke movement | +| `exclude` | Exclude current item from results | +| `exclude-multi` | Exclude selected items from results | + +## Environment Variables in Actions + +Available in command execution: + +| Variable | Description | +|----------|-------------| +| `FZF_QUERY` | Current query string | +| `FZF_ACTION` | Name of last action | +| `FZF_KEY` | Name of last key pressed | +| `FZF_PROMPT` | Current prompt string | +| `FZF_MATCH_COUNT` | Number of matches | +| `FZF_SELECT_COUNT` | Number of selections | +| `FZF_TOTAL_COUNT` | Total items | +| `FZF_POS` | Current position (1-based) | +| `FZF_LINES` | fzf height in lines | +| `FZF_COLUMNS` | fzf width in columns | +| `FZF_PORT` | HTTP server port (with --listen) | diff --git a/references/integrations.md b/references/integrations.md new file mode 100644 index 0000000..0af7dd7 --- /dev/null +++ b/references/integrations.md @@ -0,0 +1,447 @@ +# fzf Integrations Reference + +Recipes for integrating fzf with other tools. + +## Table of Contents + +- [ripgrep Integration](#ripgrep-integration) +- [fd Integration](#fd-integration) +- [bat Integration](#bat-integration) +- [Git Integration](#git-integration) +- [Docker Integration](#docker-integration) +- [Kubernetes Integration](#kubernetes-integration) +- [tmux Integration](#tmux-integration) +- [Shell Function Recipes](#shell-function-recipes) + +## ripgrep Integration + +### Basic Search with Preview + +```bash +# Search and preview with syntax highlighting +rg --line-number --no-heading --color=always '' | + fzf --ansi \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' +``` + +### Open Result in Editor + +```bash +# Search and open in vim at matching line +rg --line-number --no-heading --color=always '' | + fzf --ansi --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --bind 'enter:become(vim {1} +{2})' +``` + +### Interactive ripgrep (fzf as Frontend) + +```bash +#!/usr/bin/env bash +# Save as 'rfv' and make executable + +RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case" +INITIAL_QUERY="${*:-}" + +fzf --ansi --disabled --query "$INITIAL_QUERY" \ + --bind "start:reload:$RG_PREFIX {q}" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' +``` + +### Toggle Between ripgrep and fzf Mode + +```bash +#!/usr/bin/env bash +# CTRL-R for ripgrep mode, CTRL-F for fzf mode + +rm -f /tmp/rg-fzf-{r,f} +RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case" + +fzf --ansi --disabled --query "${*:-}" \ + --bind "start:reload($RG_PREFIX {q})+unbind(ctrl-r)" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --bind "ctrl-f:unbind(change,ctrl-f)+change-prompt(fzf> )+enable-search+rebind(ctrl-r)+transform-query(echo {q} > /tmp/rg-fzf-r; cat /tmp/rg-fzf-f)" \ + --bind "ctrl-r:unbind(ctrl-r)+change-prompt(rg> )+disable-search+reload($RG_PREFIX {q} || true)+rebind(change,ctrl-f)+transform-query(echo {q} > /tmp/rg-fzf-f; cat /tmp/rg-fzf-r)" \ + --prompt 'rg> ' \ + --delimiter : \ + --header 'CTRL-R (ripgrep) / CTRL-F (fzf)' \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(vim {1} +{2})' +``` + +## fd Integration + +### File Search with Preview + +```bash +# Find files with preview +fd --type f --hidden --follow --exclude .git | + fzf --preview 'bat --color=always {}' \ + --bind 'enter:become(vim {})' +``` + +### Set as Default Command + +```bash +# In ~/.bashrc or ~/.zshrc +export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git' +``` + +### Toggle Files/Directories + +```bash +fd --type f | + fzf --prompt 'Files> ' \ + --header 'CTRL-D: Dirs / CTRL-F: Files' \ + --bind 'ctrl-d:change-prompt(Dirs> )+reload(fd --type d)' \ + --bind 'ctrl-f:change-prompt(Files> )+reload(fd --type f)' +``` + +### Filter by Extension + +```bash +# Find Python files +fd --extension py | fzf --preview 'bat --color=always {}' + +# Multiple extensions +fd --extension js --extension ts | fzf +``` + +## bat Integration + +### Preview with Syntax Highlighting + +```bash +fzf --preview 'bat --color=always --style=numbers --line-range :500 {}' +``` + +### Highlight Specific Line + +```bash +# With line number from grep/rg +fzf --preview 'bat --color=always {1} --highlight-line {2}' --delimiter : +``` + +### Preview Window Settings + +```bash +# Show first 500 lines with header +fzf --preview 'bat --color=always --style=header,numbers --line-range :500 {}' + +# Plain output for speed +fzf --preview 'bat --color=always --style=plain {}' +``` + +## Git Integration + +### Select Branches + +```bash +# Checkout branch +git branch --all | fzf | xargs git checkout + +# With preview of recent commits +git branch --all | + fzf --preview 'git log --oneline -20 {}' | + sed 's/^[* ]*//' | sed 's/remotes\/origin\///' | + xargs git checkout +``` + +### Select Commits + +```bash +# Copy commit hash +git log --oneline | + fzf --preview 'git show --color=always {1}' | + cut -d' ' -f1 + +# Interactive rebase from selected commit +git log --oneline | + fzf --preview 'git show --color=always {1}' | + cut -d' ' -f1 | + xargs -I {} git rebase -i {}^ +``` + +### Stage Files Interactively + +```bash +# Select unstaged files to add +git status --short | + fzf --multi --preview 'git diff --color=always {2}' | + awk '{print $2}' | + xargs git add +``` + +### View Changed Files + +```bash +# Open changed files +git status --short | + fzf --multi --preview 'git diff --color=always {2}' | + awk '{print $2}' | + xargs -o vim +``` + +### Stash Management + +```bash +# Select and apply stash +git stash list | + fzf --preview 'git stash show -p {1}' --delimiter : | + cut -d: -f1 | + xargs git stash apply +``` + +### fzf-git.sh Key Bindings + +Highly recommended: [fzf-git.sh](https://github.com/junegunn/fzf-git.sh) + +Provides keybindings: +- `CTRL-G CTRL-F` - Files from git status +- `CTRL-G CTRL-B` - Branches +- `CTRL-G CTRL-T` - Tags +- `CTRL-G CTRL-R` - Remotes +- `CTRL-G CTRL-H` - Commit hashes +- `CTRL-G CTRL-S` - Stashes +- `CTRL-G CTRL-L` - Reflogs +- `CTRL-G CTRL-W` - Worktrees +- `CTRL-G CTRL-E` - Each ref (git for-each-ref) + +## Docker Integration + +### Select Containers + +```bash +# Attach to running container +docker ps --format '{{.Names}}\t{{.Image}}\t{{.Status}}' | + fzf --delimiter '\t' --with-nth 1,2,3 | + cut -f1 | + xargs -o docker attach +``` + +### Select Images + +```bash +# Remove images +docker images --format '{{.Repository}}:{{.Tag}}\t{{.ID}}\t{{.Size}}' | + fzf --multi --delimiter '\t' | + cut -f2 | + xargs docker rmi +``` + +### View Logs + +```bash +# Follow container logs +docker ps --format '{{.Names}}' | + fzf --preview 'docker logs --tail 50 {}' | + xargs -o docker logs -f +``` + +## Kubernetes Integration + +### Select Pods + +```bash +# Get shell in pod +kubectl get pods --all-namespaces -o wide | + fzf --header-lines=1 | + awk '{print "-n", $1, $2}' | + xargs -o kubectl exec -it -- /bin/sh +``` + +### Pod Logs with Follow + +```bash +pods() { + kubectl get pods --all-namespaces | + fzf --info=inline --layout=reverse --header-lines=1 \ + --prompt "$(kubectl config current-context)> " \ + --header $'CTRL-O: logs | CTRL-R: reload\n' \ + --bind 'start,ctrl-r:reload:kubectl get pods --all-namespaces' \ + --bind 'ctrl-o:execute:kubectl logs --namespace {1} {2} | less' \ + --preview-window up:follow \ + --preview 'kubectl logs --follow --tail=100 --namespace {1} {2}' +} +``` + +### Context Switching + +```bash +# Switch context +kubectl config get-contexts -o name | + fzf --preview 'kubectl config view -o jsonpath="{.contexts[?(@.name==\"{}\")]}"' | + xargs kubectl config use-context +``` + +## tmux Integration + +### Select Sessions + +```bash +# Attach to session +tmux list-sessions -F '#S' | + fzf --preview 'tmux capture-pane -pt {}' | + xargs tmux switch-client -t +``` + +### Select Windows + +```bash +# Switch to window +tmux list-windows -a -F '#S:#W' | + fzf --preview 'tmux capture-pane -pt {}' | + xargs tmux switch-client -t +``` + +### tmux Popup + +```bash +# Use fzf in tmux popup +fzf --tmux center,80% +``` + +## Shell Function Recipes + +### Interactive cd + +```bash +# cd with preview +fcd() { + local dir + dir=$(fd --type d --hidden --follow --exclude .git | + fzf --preview 'tree -C {} | head -50') && + cd "$dir" +} +``` + +### Edit Recent Files + +```bash +# Edit recent git files +vg() { + local files + files=$(git ls-files --modified --others --exclude-standard | + fzf --multi --preview 'bat --color=always {}') && + vim $files +} +``` + +### Kill Process + +```bash +# Interactive process killer +fkill() { + local pid + pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + if [ -n "$pid" ]; then + echo "$pid" | xargs kill -9 + fi +} +``` + +### Search History + +```bash +# Enhanced history search +fh() { + eval $(history | fzf +s --tac | sed 's/ *[0-9]* *//') +} +``` + +### Open GitHub PR + +```bash +# Select and open PR +gpr() { + gh pr list | + fzf --preview 'gh pr view {1}' | + awk '{print $1}' | + xargs gh pr checkout +} +``` + +### Man Page Viewer + +```bash +# Browse man pages +fman() { + man -k . | + fzf --prompt='Man> ' --preview 'man {1}' | + awk '{print $1}' | + xargs man +} +``` + +### Environment Variables + +Add to your shell config: + +```bash +# Better defaults +export FZF_DEFAULT_OPTS=' + --height 40% + --layout reverse + --border + --info inline + --preview-window right,50%,border-left +' + +# CTRL-T with preview +export FZF_CTRL_T_OPTS=" + --preview 'bat --color=always --style=numbers --line-range :500 {}' + --bind 'ctrl-/:change-preview-window(down|hidden|)' +" + +# CTRL-R with preview +export FZF_CTRL_R_OPTS=" + --preview 'echo {}' + --preview-window up:3:hidden:wrap + --bind 'ctrl-/:toggle-preview' + --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' + --header 'CTRL-Y to copy' +" + +# ALT-C with tree preview +export FZF_ALT_C_OPTS=" + --preview 'tree -C {} | head -100' +" +``` + +## Tips + +### Performance + +- Avoid `--ansi` in `FZF_DEFAULT_OPTS` (slows scanning) +- Use `--nth` sparingly (requires tokenization) +- Prefer string delimiter over regex +- Use `fd` instead of `find` for file listing + +### Debugging + +```bash +# Test preview command +echo "test.txt" | fzf --preview 'bat --color=always {}' + +# See what fzf receives +fzf --preview 'echo {} | cat -v' +``` + +### Escaping + +```bash +# Escape special characters in queries +fzf --query 'foo\ bar' # Literal space + +# In shell scripts, quote properly +fzf --bind "enter:execute(vim '{}')" +``` diff --git a/references/options.md b/references/options.md new file mode 100644 index 0000000..73957e7 --- /dev/null +++ b/references/options.md @@ -0,0 +1,409 @@ +# fzf Options Reference + +Complete reference for all fzf command-line options. + +## Table of Contents + +- [Search Options](#search-options) +- [Input/Output Options](#inputoutput-options) +- [Display Mode Options](#display-mode-options) +- [Layout Options](#layout-options) +- [List Section Options](#list-section-options) +- [Input Section Options](#input-section-options) +- [Preview Options](#preview-options) +- [Header/Footer Options](#headerfooter-options) +- [Scripting Options](#scripting-options) +- [Directory Walker Options](#directory-walker-options) +- [History Options](#history-options) +- [Color Options](#color-options) +- [Shell Integration](#shell-integration) + +## Search Options + +### Mode Selection + +| Option | Description | +|--------|-------------| +| `-x, --extended` | Extended search mode (default) | +| `+x, --no-extended` | Disable extended search | +| `-e, --exact` | Exact match mode | +| `-i, --ignore-case` | Case-insensitive search | +| `+i, --no-ignore-case` | Case-sensitive search | +| `--smart-case` | Smart case (default) | +| `--literal` | Don't normalize latin characters | + +### Algorithm + +| Option | Description | +|--------|-------------| +| `--scheme=SCHEME` | Scoring scheme: `default`, `path`, `history` | +| `--algo=TYPE` | Algorithm: `v2` (quality), `v1` (speed) | + +### Field Processing + +| Option | Description | +|--------|-------------| +| `-d, --delimiter=STR` | Field delimiter (regex or string) | +| `-n, --nth=N[,..]` | Limit search to specific fields | +| `--with-nth=N[,..]` | Transform display (field expressions) | +| `--accept-nth=N[,..]` | Fields to print on accept | + +### Sorting + +| Option | Description | +|--------|-------------| +| `+s, --no-sort` | Don't sort results | +| `--tiebreak=CRI[,..]` | Tiebreak criteria | + +**Tiebreak criteria:** +- `length` - Shorter line preferred (default) +- `chunk` - Shorter matched chunk +- `pathname` - Match in filename preferred +- `begin` - Match closer to beginning +- `end` - Match closer to end +- `index` - Earlier in input (implicit last) + +### Other Search Options + +| Option | Description | +|--------|-------------| +| `--disabled` | Disable search (selector mode) | +| `--tail=NUM` | Limit items in memory | + +## Input/Output Options + +| Option | Description | +|--------|-------------| +| `--read0` | NUL-delimited input | +| `--print0` | NUL-delimited output | +| `--ansi` | Process ANSI color codes | +| `--sync` | Synchronous search | +| `--no-tty-default` | Use stderr for TTY detection | + +## Display Mode Options + +### Height Mode + +```bash +fzf --height=HEIGHT[%] # Fixed height +fzf --height=~HEIGHT[%] # Adaptive height (shrinks for small lists) +fzf --height=-N # Terminal height minus N +``` + +| Option | Description | +|--------|-------------| +| `--height=HEIGHT[%]` | Non-fullscreen mode | +| `--min-height=HEIGHT[+]` | Minimum height (with percentage height) | + +### tmux Mode + +```bash +fzf --tmux [center|top|bottom|left|right][,SIZE[%]][,SIZE[%]] +``` + +Examples: +```bash +fzf --tmux center # Center, 50% +fzf --tmux 80% # Center, 80% +fzf --tmux left,40% # Left side, 40% width +fzf --tmux bottom,30% # Bottom, 30% height +fzf --tmux top,80%,40% # Top, 80% width, 40% height +``` + +## Layout Options + +| Option | Description | +|--------|-------------| +| `--layout=LAYOUT` | `default`, `reverse`, `reverse-list` | +| `--reverse` | Alias for `--layout=reverse` | +| `--margin=MARGIN` | Margin around finder | +| `--padding=PADDING` | Padding inside border | + +### Border Options + +| Option | Description | +|--------|-------------| +| `--border[=STYLE]` | Draw border around finder | +| `--border-label=LABEL` | Label on border | +| `--border-label-pos=N[:pos]` | Label position | + +**Border styles:** +`rounded`, `sharp`, `bold`, `double`, `block`, `thinblock`, `horizontal`, `vertical`, `line`, `top`, `bottom`, `left`, `right`, `none` + +## List Section Options + +### Selection + +| Option | Description | +|--------|-------------| +| `-m, --multi[=MAX]` | Enable multi-select (optional limit) | +| `+m, --no-multi` | Disable multi-select | + +### Display + +| Option | Description | +|--------|-------------| +| `--highlight-line` | Highlight entire current line | +| `--cycle` | Enable cyclic scroll | +| `--wrap` | Enable line wrap | +| `--wrap-sign=STR` | Indicator for wrapped lines | +| `--no-multi-line` | Disable multi-line items | +| `--raw` | Show non-matching items (dimmed) | +| `--tac` | Reverse input order | +| `--track` | Track current selection | + +### Scrolling + +| Option | Description | +|--------|-------------| +| `--scroll-off=LINES` | Lines to keep visible at edges | +| `--no-hscroll` | Disable horizontal scroll | +| `--hscroll-off=COLS` | Columns to keep visible | + +### Markers + +| Option | Description | +|--------|-------------| +| `--pointer=STR` | Pointer character | +| `--marker=STR` | Selection marker | +| `--marker-multi-line=STR` | Multi-line marker (3 chars) | +| `--ellipsis=STR` | Truncation indicator | +| `--scrollbar=CHAR[CHAR]` | Scrollbar characters | +| `--no-scrollbar` | Disable scrollbar | + +### Gap and Freeze + +| Option | Description | +|--------|-------------| +| `--gap[=N]` | Empty lines between items | +| `--gap-line[=STR]` | Line character for gaps | +| `--freeze-left=N` | Freeze N left fields | +| `--freeze-right=N` | Freeze N right fields | +| `--keep-right` | Keep right end visible | + +### List Border + +| Option | Description | +|--------|-------------| +| `--list-border[=STYLE]` | Border around list | +| `--list-label=LABEL` | List border label | +| `--list-label-pos=N[:pos]` | Label position | + +## Input Section Options + +| Option | Description | +|--------|-------------| +| `--prompt=STR` | Input prompt (default: `> `) | +| `--info=STYLE` | Info display style | +| `--info-command=CMD` | Custom info generator | +| `--no-info` | Hide info line | +| `--no-input` | Hide input section | +| `--ghost=TEXT` | Ghost text when empty | +| `--filepath-word` | Path-aware word movements | +| `--separator=STR` | Separator line character | +| `--no-separator` | Hide separator | + +**Info styles:** +`default`, `right`, `hidden`, `inline`, `inline:PREFIX`, `inline-right`, `inline-right:PREFIX` + +### Input Border + +| Option | Description | +|--------|-------------| +| `--input-border[=STYLE]` | Border around input | +| `--input-label=LABEL` | Input border label | +| `--input-label-pos=N[:pos]` | Label position | + +## Preview Options + +### Preview Command + +```bash +fzf --preview='COMMAND' +``` + +**Placeholders:** +- `{}` - Current item (quoted) +- `{+}` - Selected items (space-separated) +- `{q}` - Query string +- `{n}` - Zero-based index +- `{1}`, `{2}`, etc. - Nth field +- `{-1}` - Last field +- `{1..3}` - Fields 1-3 +- `{2..}` - Fields 2 to end + +**Flags:** +- `{+}` - All selected +- `{f}` - Write to temp file +- `{r}` - Raw (unquoted) +- `{s}` - Preserve whitespace + +### Preview Window + +```bash +fzf --preview-window=OPTS +``` + +**Position:** `up`, `down`, `left`, `right` (default: right) + +**Options:** +- `SIZE[%]` - Window size +- `border-STYLE` - Border style +- `wrap` / `nowrap` - Line wrapping +- `follow` / `nofollow` - Auto-scroll +- `cycle` / `nocycle` - Cyclic scroll +- `info` / `noinfo` - Show scroll info +- `hidden` - Start hidden +- `+SCROLL[/DENOM]` - Initial scroll offset +- `~HEADER_LINES` - Fixed header lines +- `default` - Reset to defaults +- `