> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/sxyazi/yazi/llms.txt
> Use this file to discover all available pages before exploring further.

# Search

> Search and filter files using find, filter, fd, ripgrep, and fzf

Yazi provides multiple search methods for finding files and content, with deep integration into popular command-line tools.

## Quick Find

Find files by name in the current directory:

### Forward and Backward Search

| Key | Command                   | Description                          |
| --- | ------------------------- | ------------------------------------ |
| `/` | `find --smart`            | Find next file (forward search)      |
| `?` | `find --previous --smart` | Find previous file (backward search) |
| `n` | `find_arrow`              | Jump to next match                   |
| `N` | `find_arrow --previous`   | Jump to previous match               |

<Steps>
  <Step title="Start search">
    Press `/` (forward) or `?` (backward)
  </Step>

  <Step title="Type pattern">
    Enter the search pattern (smart case matching)
  </Step>

  <Step title="Navigate matches">
    * Press `n` to go to next match
    * Press `N` to go to previous match
    * Matches are highlighted with indicators
  </Step>

  <Step title="Cancel search">
    Press `<Esc>` or `<C-s>` to exit search mode
  </Step>
</Steps>

### Smart Case Matching

The `--smart` flag enables smart case sensitivity:

* **Lowercase pattern**: Case-insensitive matching
  * `/readme` matches "README", "readme", "ReadMe"
* **Mixed case pattern**: Case-sensitive matching
  * `/ReadMe` only matches "ReadMe"

## Filter

Filter files in the current directory to show only matches:

```bash theme={null}
f  # Start filter with smart case
```

Filter vs Find:

<Tabs>
  <Tab title="Filter">
    **Hides non-matching files**

    ```bash theme={null}
    f        # Start filter
    *.rs     # Only Rust files visible
    ```

    * Changes what files are displayed
    * Useful for focusing on specific file types
    * Affects operations like select all
  </Tab>

  <Tab title="Find">
    **Jumps between matches**

    ```bash theme={null}
    /        # Start find
    config   # Jumps to matches
    n        # Next match
    ```

    * All files remain visible
    * Highlights matching files
    * Quick navigation between results
  </Tab>
</Tabs>

<Note>
  Filtered files are temporarily hidden but not deleted. Clear the filter with `<Esc>` to show all files again.
</Note>

## Search with fd

Search for files using `fd` (faster alternative to `find`):

```bash theme={null}
s  # Search files via fd
```

The `search --via=fd` command:

* Recursively searches from the current directory
* Respects `.gitignore` by default
* Supports regex patterns
* Much faster than traditional `find`

**Example patterns:**

```bash theme={null}
s → *.toml           # Find all TOML files
s → README           # Find files named README
s → ^test            # Files starting with "test"
```

### fd Features

* **Fast**: Uses parallel directory traversal
* **Smart**: Ignores hidden files and `.gitignore` patterns
* **Colorful**: Syntax-highlighted results
* **Regex**: Full regular expression support

## Search with ripgrep

Search file contents using `ripgrep`:

```bash theme={null}
S  # Search file contents via ripgrep (capital S)
```

The `search --via=rg` command:

* Searches inside file contents
* Extremely fast, even on large codebases
* Respects `.gitignore`
* Returns files containing the pattern

**Example searches:**

```bash theme={null}
S → TODO             # Files containing "TODO"
S → fn main          # Rust files with main function
S → "error handling" # Files with exact phrase
```

<Tabs>
  <Tab title="fd (filename)">
    ```bash theme={null}
    s  # Search by filename
    ```

    Use when you:

    * Know the filename
    * Want to find specific file types
    * Need path-based matching
  </Tab>

  <Tab title="ripgrep (content)">
    ```bash theme={null}
    S  # Search by content
    ```

    Use when you:

    * Remember file contents but not name
    * Want to find code/text patterns
    * Need to search across many files
  </Tab>
</Tabs>

## Jump with fzf

Fuzzy find files and directories using `fzf`:

```bash theme={null}
z  # Jump to file/directory with fzf
```

The fzf integration provides:

* **Fuzzy matching**: Type partial names in any order
* **Interactive preview**: See file contents as you search
* **Fast filtering**: Real-time results as you type
* **Multi-select**: Select multiple files with `<Tab>`

### fzf Workflow

<Steps>
  <Step title="Launch fzf">
    Press `z` to open the fzf interface
  </Step>

  <Step title="Type query">
    Enter fuzzy search terms (spaces for AND logic)

    ```
    src main rs  # Matches "src/main.rs"
    cfg toml     # Matches config.toml, yazi.toml, etc.
    ```
  </Step>

  <Step title="Navigate results">
    * `<Up>`/`<Down>` or `<C-j>`/`<C-k>` to move
    * `<Tab>` to select multiple files
    * `<Enter>` to confirm
  </Step>

  <Step title="Result action">
    * Single file: Navigates to it or opens it
    * Directory: Changes to that directory
    * Multiple selections: Toggles them in Yazi
  </Step>
</Steps>

### fzf with Selection

If files are already selected when launching fzf:

```bash theme={null}
<Space>  # Select some files
<Space>
z        # Launch fzf with selected files as input
```

This lets you:

* Further filter your selection
* Remove specific files from selection
* Add to existing selection

<Note>
  The fzf plugin is implemented in `/home/daytona/workspace/source/yazi-plugin/preset/plugins/fzf.lua:11`. It uses multi-select mode (`-m` flag) by default.
</Note>

## Jump with zoxide

Jump to frequently used directories with `zoxide`:

```bash theme={null}
Z  # Jump via zoxide (capital Z)
```

zoxide features:

* **Frecency algorithm**: Ranks by frequency and recency
* **Smart matching**: Type partial directory names
* **Learning**: Automatically tracks your navigation patterns

**Example:**

```bash theme={null}
Z → proj     # Jumps to ~/projects (if frequently visited)
Z → conf     # Jumps to ~/.config
Z → doc      # Jumps to ~/Documents
```

## Cancel Search

Stop ongoing searches:

```bash theme={null}
<C-s>  # Cancel the ongoing search
<Esc>  # Exit search mode or clear filter
```

| Context       | `<Esc>` behavior | `<C-s>` behavior        |
| ------------- | ---------------- | ----------------------- |
| Active search | Exit search mode | Cancel search operation |
| Filter active | Clear filter     | N/A                     |
| Find results  | Clear highlights | Clear highlights        |

## Search Methods Comparison

| Method      | Key | Tool     | Scope             | Use Case                     |
| ----------- | --- | -------- | ----------------- | ---------------------------- |
| **Find**    | `/` | Built-in | Current directory | Quick file jumps             |
| **Filter**  | `f` | Built-in | Current directory | Focus on file subset         |
| **fd**      | `s` | fd       | Recursive         | Find files by name           |
| **ripgrep** | `S` | ripgrep  | Recursive content | Find by file contents        |
| **fzf**     | `z` | fzf      | Recursive         | Fuzzy interactive search     |
| **zoxide**  | `Z` | zoxide   | Database          | Jump to frequent directories |

## Search Tips

<Tabs>
  <Tab title="Performance">
    * `fd` and `ripgrep` are extremely fast even on large directories
    * Filter is instant since it only processes visible files
    * fzf builds an index on-demand for responsive searching
  </Tab>

  <Tab title="Patterns">
    * Use `*` for wildcards in filter: `*.md`
    * Use `^` for start of line in fd/rg: `^test`
    * Fuzzy matching in fzf doesn't require exact patterns
  </Tab>

  <Tab title="Integration">
    * Search results can be selected in bulk with `<C-a>`
    * Combine searches: filter first, then find within results
    * Use fzf multi-select (`<Tab>`) to build selections
  </Tab>
</Tabs>

## Advanced Search Examples

### Example 1: Find and Select All Markdown Files

```bash theme={null}
f        # Start filter
*.md     # Show only .md files
<C-a>    # Select all visible files
<Esc>    # Clear filter (selection persists)
y        # Yank selected .md files
```

### Example 2: Search Code for TODOs

```bash theme={null}
S        # Search with ripgrep
TODO     # Find all TODOs
# Yazi shows files containing TODO
<Enter>  # Open first file
```

### Example 3: Complex fd Search

```bash theme={null}
s                    # fd search
^(test|spec).*\.rs$  # Find Rust test files
```

### Example 4: Multi-Tool Workflow

```bash theme={null}
Z        # Jump to project directory with zoxide
S        # Search for "FIXME" in code
z        # Use fzf to narrow down results
<Tab>    # Multi-select files in fzf
<Enter>  # Files are now selected in Yazi
o        # Open all selected files
```

<Warning>
  Make sure `fd`, `ripgrep`, `fzf`, and `zoxide` are installed on your system for their respective search features to work.
</Warning>
