fuzzy-selecting

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

fzf: Interactive Fuzzy Finder

fzf:交互式模糊查找器

Always invoke fzf skill for interactive fuzzy selection - do not execute bash commands directly.
Use fzf for interactive fuzzy selection and filtering of any command-line list.
进行交互式模糊选择时,请始终调用fzf技能——不要直接执行bash命令。
使用fzf对任意命令行列表进行交互式模糊选择和过滤。

Default Strategy

默认策略

Invoke fzf skill for interactive fuzzy selection from any list with preview capabilities. Use when choosing from search results, files, processes, or any command output.
Common workflow: Discovery skill (fd, ripgrep, jq, yq) → fzf skill → other skills (bat, xargs) for interactive selection and action.
调用fzf技能对带有预览功能的任意列表进行交互式模糊选择。适用于从搜索结果、文件、进程或任何命令输出中进行选择的场景。
常见工作流:发现类技能(fd、ripgrep、jq、yq)→ fzf技能 → 其他技能(bat、xargs),完成交互式选择与操作。

Key Options

关键选项

Display Modes

显示模式

  • --height N[%]
    set height (percent or exact lines)
  • --tmux [POS][SIZE][,border]
    tmux popup mode
  • --layout default|reverse|reverse-list
    layout direction
  • --border [rounded|sharp|thin]
    add border
  • --style default|full|minimal
    UI preset
  • --height N[%]
    设置高度(百分比或精确行数)
  • --tmux [POS][SIZE][,border]
    tmux弹窗模式
  • --layout default|reverse|reverse-list
    布局方向
  • --border [rounded|sharp|thin]
    添加边框
  • --style default|full|minimal
    UI预设

Search & Matching

搜索与匹配

  • -e/--exact
    exact matching instead of fuzzy
  • --scheme default|path|history
    input type optimization
  • --delimiter STR
    custom field delimiter
  • --nth N..
    search specific fields only
  • -e/--exact
    精确匹配(替代模糊匹配)
  • --scheme default|path|history
    输入类型优化
  • --delimiter STR
    自定义字段分隔符
  • --nth N..
    仅搜索特定字段

Preview Window

预览窗口

  • --preview "CMD {}"
    external command preview
  • --preview-window POSITION[SIZE][,border]
    preview configuration
  • --preview-label TEXT
    custom preview label
  • --preview "CMD {}"
    外部命令预览
  • --preview-window POSITION[SIZE][,border]
    预览配置
  • --preview-label TEXT
    自定义预览标签

Selection Options

选择选项

  • -m/--multi
    multi-select mode (TAB to mark)
  • --bind KEY:ACTION
    custom key bindings
  • --prompt "TEXT"
    custom prompt string
  • --header "TEXT"
    custom header text
  • -m/--multi
    多选模式(按TAB标记)
  • --bind KEY:ACTION
    自定义按键绑定
  • --prompt "TEXT"
    自定义提示字符串
  • --header "TEXT"
    自定义头部文本

Performance Options

性能选项

  • --tac
    reverse input order (top-down)
  • --with-nth N..
    display specific fields
  • --ansi
    parse ANSI color codes
  • --tac
    反转输入顺序(自上而下)
  • --with-nth N..
    显示特定字段
  • --ansi
    解析ANSI颜色代码

When to Use

使用场景

  • File Selection: Interactive file browsing with preview
  • Command History: Search and reuse previous commands
  • Process Management: Select and manage running processes
  • Git Integration: Browse commits, branches, files
  • Multi-Select Operations: Batch processing of selected items
  • 文件选择:带预览的交互式文件浏览
  • 命令历史:搜索并复用之前的命令
  • 进程管理:选择并管理运行中的进程
  • Git集成:浏览提交记录、分支、文件
  • 多选操作:对选中项目进行批处理

Common Workflows

常见工作流

  • fd | fzf → bat
    : Find files, select, view with syntax highlighting
  • ripgrep | fzf → vim
    : Search content, select matches, edit files
  • jq/yq | fzf → bat
    : Extract data, select entries, view details
  • git log | fzf → show
    : Browse commits, select, view changes
  • ps | fzf → kill
    : List processes, select, terminate
  • find | fzf -m → xargs
    : Multiple selection for batch operations
  • fd | fzf → bat
    :查找文件,选择后使用语法高亮查看
  • ripgrep | fzf → vim
    :搜索内容,选择匹配项后编辑文件
  • jq/yq | fzf → bat
    :提取数据,选择条目后查看详情
  • git log | fzf → show
    :浏览提交记录,选择后查看变更
  • ps | fzf → kill
    :列出进程,选择后终止
  • find | fzf -m → xargs
    :多选进行批量操作

Core Principles

核心原则

  1. Interactive Filtering: Real-time fuzzy matching as you type
  2. Universal Input: Works with any list from STDIN or file system
  3. Extensible: Customizable through bindings and preview commands
  4. Performance: Optimized to handle millions of items instantly
  1. 交互式过滤:输入时实时进行模糊匹配
  2. 通用输入:兼容来自标准输入(STDIN)或文件系统的任意列表
  3. 可扩展:通过绑定和预览命令进行自定义
  4. 高性能:优化后可瞬间处理数百万条项目

Detailed Reference

详细参考

For comprehensive search patterns, key bindings, preview configurations, and integration examples, load fzf guide when needing:
  • Custom key bindings and actions
  • Advanced preview window configuration
  • Multi-select workflows
  • Tmux integration
  • Shell setup functions
The guide includes:
  • Basic usage and display modes
  • Search syntax and matching patterns
  • Multi-select operations and key bindings
  • Preview window configuration
  • Integration examples (git, processes, file systems)
  • Performance optimization and troubleshooting
  • Shell integration setup and custom functions
如需全面了解搜索模式、按键绑定、预览配置和集成示例,可加载fzf指南,适用于以下场景:
  • 自定义按键绑定与操作
  • 高级预览窗口配置
  • 多选工作流
  • Tmux集成
  • Shell设置函数
该指南包含:
  • 基础用法与显示模式
  • 搜索语法与匹配模式
  • 多选操作与按键绑定
  • 预览窗口配置
  • 集成示例(Git、进程、文件系统)
  • 性能优化与故障排除
  • Shell集成设置与自定义函数

Skill Combinations

技能组合

For Discovery Phase

发现阶段

  • fd → fzf: Interactive file selection from search results
  • ripgrep → fzf: Interactive selection from search matches
  • jq/yq → fzf: Interactive selection from extracted data
  • git log/branch → fzf: Interactive git history browsing
  • fd → fzf:从搜索结果中交互式选择文件
  • ripgrep → fzf:从搜索匹配项中交互式选择
  • jq/yq → fzf:从提取的数据中交互式选择
  • git log/branch → fzf:交互式浏览Git历史

For Analysis Phase

分析阶段

  • any_command → fzf → bat: Select items and preview with syntax highlighting
  • fd → fzf --preview="bat {}": File browser with syntax preview
  • ripgrep → fzf --preview="bat {1} +{2}": Search results with file preview
  • any_command → fzf → bat:选择项目并使用语法高亮预览
  • fd → fzf --preview="bat {}":带语法预览的文件浏览器
  • ripgrep → fzf --preview="bat {1} +{2}":带文件预览的搜索结果

For Refactoring Phase

重构阶段

  • any_command → fzf -m: Batch process multiple selected items
  • find | fzf -m | xargs: Classic multi-select pattern
  • ps | fzf -m | xargs kill: Multi-process management
  • any_command → fzf -m:对多个选中项目进行批处理
  • find | fzf -m | xargs:经典多选模式
  • ps | fzf -m | xargs kill:多进程管理

Integration Examples

集成示例

bash
undefined
bash
undefined

Interactive code search and edit

Interactive code search and edit

rg "pattern" | fzf --preview="bat --color=always --highlight-line {2} {1}" | awk '{print $1}' | xargs vim
rg "pattern" | fzf --preview="bat --color=always --highlight-line {2} {1}" | awk '{print $1}' | xargs vim

Interactive dependency management

Interactive dependency management

jq -r '.dependencies | keys[]' package.json | fzf --multi | xargs npm uninstall
jq -r '.dependencies | keys[]' package.json | fzf --multi | xargs npm uninstall
undefined