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

# Command Palette

> Quick access to files, commands, buffers, and line navigation with Fresh's fuzzy-finding command palette

The command palette is your keyboard-driven control center in Fresh. Press `Ctrl+P` to instantly access files, run commands, switch buffers, or jump to any line — all with fuzzy matching.

## Opening the Command Palette

| Shortcut | Action                |
| -------- | --------------------- |
| `Ctrl+P` | Open command palette  |
| `Esc`    | Close command palette |

<Tip>
  The command palette opens in **file finder mode** by default, letting you quickly open files without typing any prefix.
</Tip>

## Command Palette Modes

The command palette has four distinct modes, each triggered by a prefix character:

| Prefix   | Mode            | Description                            |
| -------- | --------------- | -------------------------------------- |
| *(none)* | **File Finder** | Fuzzy search for files in your project |
| `>`      | **Commands**    | Search and run editor commands         |
| `#`      | **Buffers**     | Switch between open buffers by name    |
| `:`      | **Go to Line**  | Jump to a specific line number         |

<Note>
  A hints line at the bottom of the palette shows available prefixes and their meanings.
</Note>

## File Finder Mode

The default mode — open files quickly with fuzzy matching:

<Steps>
  <Step title="Open palette">
    Press `Ctrl+P` (opens in file finder mode automatically)
  </Step>

  <Step title="Type to search">
    Type parts of the filename or path
  </Step>

  <Step title="Select and open">
    Use `↑`/`↓` arrows to select, press `Enter` to open, or `Tab` to accept the top suggestion
  </Step>
</Steps>

### Fuzzy Matching

Fresh's fuzzy matching is incredibly flexible:

<CodeGroup>
  ```text Example 1: Match by acronym theme={null}
  Type: "fge"
  Matches: features/groups/editor.tsx
  ```

  ```text Example 2: Space-separated terms theme={null}
  Type: "feat group"
  Matches: features/groups/view.tsx
  (Both "feat" and "group" appear in the path)
  ```

  ```text Example 3: Partial filename theme={null}
  Type: "edit"
  Matches:
    - src/editor.ts
    - components/EditButton.tsx
    - features/editing.mdx
  ```
</CodeGroup>

<Tip>
  **Pro Tip**: Space-separated terms match independently, so `feat group` finds files containing both "feat" and "group" anywhere in their path.
</Tip>

### File Finder Behavior

<CardGroup cols={2}>
  <Card title="Git Integration" icon="code-branch">
    Uses git to find files — only shows files tracked by git (respects `.gitignore`)
  </Card>

  <Card title="Fast" icon="bolt">
    Indexes files in the background for instant results even in large projects
  </Card>

  <Card title="Smart Ranking" icon="ranking-star">
    Files you've opened recently appear higher in results
  </Card>

  <Card title="Path Context" icon="folder-tree">
    Shows full file paths to disambiguate files with the same name
  </Card>
</CardGroup>

## Command Mode

Search and execute any editor command:

<Steps>
  <Step title="Open command mode">
    Press `Ctrl+P` then type `>` (or just press `Ctrl+P` and type `>`)
  </Step>

  <Step title="Search for command">
    Type to filter commands (e.g., "split", "theme", "save")
  </Step>

  <Step title="Execute">
    Press `Enter` to run the selected command
  </Step>
</Steps>

### Commonly Used Commands

<AccordionGroup>
  <Accordion title="View & Layout Commands">
    * **Split Vertical** — Create side-by-side panes
    * **Split Horizontal** — Create top/bottom panes
    * **Close Split** — Remove current split
    * **Toggle File Explorer** — Show/hide sidebar
    * **Toggle Line Wrap** — Wrap long lines
    * **Toggle Line Numbers** — Show/hide line numbers
  </Accordion>

  <Accordion title="File Operations">
    * **Save** — Save current file
    * **Save As** — Save to a new location
    * **Close Buffer** — Close current file
    * **New File** — Create a new buffer
    * **Revert File** — Reload from disk
  </Accordion>

  <Accordion title="Editing Commands">
    * **Sort Lines** — Sort selected lines alphabetically
    * **Trim Trailing Whitespace** — Remove trailing spaces
    * **Toggle Comment** — Comment/uncomment lines
    * **Go to Matching Bracket** — Jump to matching brace
  </Accordion>

  <Accordion title="Search & Replace">
    * **Search and Replace in Project** — Project-wide find/replace
    * **Query Replace** — Interactive y/n/! replace
    * **Find Next** — Jump to next search match
  </Accordion>

  <Accordion title="LSP Commands">
    * **Go to Definition** — Jump to symbol definition
    * **Find References** — Show all usages
    * **Rename Symbol** — Rename across files
    * **Format Document** — Auto-format code
    * **Code Actions** — Show available fixes
  </Accordion>

  <Accordion title="Settings & Customization">
    * **Open Settings** — Open settings UI
    * **Select Theme** — Browse and apply color themes
    * **Configure Keybindings** — Open keybinding editor
    * **Set Language** — Override file syntax highlighting
  </Accordion>
</AccordionGroup>

<Tip>
  **Discoverability**: Not sure what command you need? Just type keywords like "format", "git", or "split" to see related commands.
</Tip>

## Buffer Switch Mode

Quickly switch between open files:

<Steps>
  <Step title="Open buffer mode">
    Press `Ctrl+P` then type `#`
  </Step>

  <Step title="Type buffer name">
    Type part of the filename or path
  </Step>

  <Step title="Switch">
    Press `Enter` to switch to the selected buffer
  </Step>
</Steps>

<Note>
  **Buffer vs File Finder**: Buffer mode (`#`) only shows currently open files, while file finder (no prefix) searches all files in your project.
</Note>

### When to Use Buffer Mode

<CardGroup cols={2}>
  <Card title="Use Buffer Mode When" icon="check">
    * Switching between files you already have open
    * You have many files open and want to filter by name
    * You want to see what's currently open
  </Card>

  <Card title="Use File Finder When" icon="folder-open">
    * Opening a file that isn't currently open
    * You don't remember if the file is already open
    * Exploring the project structure
  </Card>
</CardGroup>

## Go to Line Mode

Jump directly to any line number:

<Steps>
  <Step title="Open go to line">
    Press `Ctrl+G` (direct shortcut) or `Ctrl+P` then type `:`
  </Step>

  <Step title="Enter line number">
    Type the line number (e.g., `42`)
  </Step>

  <Step title="Jump">
    Press `Enter` to move cursor to that line
  </Step>
</Steps>

<Tip>
  **Direct Shortcut**: `Ctrl+G` is faster than `Ctrl+P` then `:` for go to line.
</Tip>

### Large File Support

When working with large files:

<Steps>
  <Step title="File shows byte offsets">
    Large files display byte offsets instead of line numbers for performance
  </Step>

  <Step title="Use go to line">
    Press `Ctrl+G` — Fresh offers to scan the file for line numbers
  </Step>

  <Step title="Wait for scan">
    Only the line index is kept in memory, not file contents. Over SSH, scanning runs server-side.
  </Step>

  <Step title="Navigate normally">
    After scanning, go to line works with line numbers
  </Step>
</Steps>

## Command Palette Tips

<AccordionGroup>
  <Accordion title="No need to memorize prefixes">
    You can always start typing in file finder mode (no prefix), then add `>`, `#`, or `:` to switch modes mid-search.
  </Accordion>

  <Accordion title="Tab for autocomplete">
    Press `Tab` to accept the top suggestion in any mode. Great for quick file opening.
  </Accordion>

  <Accordion title="Recent files appear first">
    The file finder ranks recently opened files higher, so your most-used files are always at the top.
  </Accordion>

  <Accordion title="Use command mode for discovery">
    Not sure what features Fresh has? Open command mode (`>`) and type keywords to explore.
  </Accordion>

  <Accordion title="Command palette works everywhere">
    You can open the command palette from any context — editor, terminal, settings — though some commands may only be available in specific contexts.
  </Accordion>
</AccordionGroup>

## Keyboard Navigation

Navigate the command palette efficiently:

| Shortcut    | Action                                               |
| ----------- | ---------------------------------------------------- |
| `↑` / `↓`   | Move selection up/down                               |
| `Enter`     | Execute selected item (open file, run command, etc.) |
| `Tab`       | Accept top suggestion                                |
| `Esc`       | Close command palette                                |
| `Backspace` | Delete character (or clear prefix if at start)       |

## Examples and Workflows

### Workflow 1: Quickly Open Related Files

<Steps>
  <Step title="Open component">
    `Ctrl+P` → type `Button` → `Enter`
  </Step>

  <Step title="Open test file">
    `Ctrl+P` → type `Button test` → `Enter`
  </Step>

  <Step title="Open styles">
    `Ctrl+P` → type `Button css` → `Enter`
  </Step>
</Steps>

### Workflow 2: Split and Format

<Steps>
  <Step title="Create split">
    `Ctrl+P` → `>` → type `split vert` → `Enter`
  </Step>

  <Step title="Open file in split">
    `Ctrl+P` → type filename → `Enter`
  </Step>

  <Step title="Format code">
    `Ctrl+P` → `>` → type `format` → `Enter`
  </Step>
</Steps>

### Workflow 3: Jump to Error

<Steps>
  <Step title="See error on line 156">
    Compiler output shows: `error on line 156`
  </Step>

  <Step title="Jump directly">
    `Ctrl+G` → type `156` → `Enter`
  </Step>
</Steps>

## Customizing the Command Palette

While the command palette itself isn't customizable, you can:

<CardGroup cols={2}>
  <Card title="Add Custom Keybindings" icon="keyboard">
    Bind frequently used commands to keyboard shortcuts. See [Keyboard Configuration](/configuration/keyboard).
  </Card>

  <Card title="Create Aliases" icon="link">
    Some commands have multiple names/aliases that appear in search results.
  </Card>
</CardGroup>

## Performance

<Tip>
  **Fast Even in Large Projects**: Fresh's command palette is optimized for large codebases. The file finder can handle projects with 100,000+ files without lag.
</Tip>

<Note>
  **Indexing**: File finder uses git which indexes your repository. First search may take a moment in very large repos, but subsequent searches are near-instant.
</Note>

## Related Documentation

<CardGroup cols={3}>
  <Card title="Navigation" icon="compass" href="/features/navigation">
    Learn about all navigation features
  </Card>

  <Card title="File Explorer" icon="folder-tree" href="/features/file-explorer">
    Browse files visually with the sidebar
  </Card>

  <Card title="Keyboard Configuration" icon="keyboard" href="/configuration/keyboard">
    Customize keyboard shortcuts
  </Card>
</CardGroup>
