| AnyBrackets/MiniBrackets | Parentheses (`()`), Square brackets (`[]`), Curly braces (`{}`), Angle brackets (`<>`) |
Both "Any" and "Mini" variants work with the same character sets, but differ in their selection strategy.
#### AnyQuotes and AnyBrackets (Traditional Vim behavior)
These text objects implement traditional Vim behavior:
- **Selection priority**: Finds the innermost (closest) quotes or brackets first
- **Fallback mechanism**: If none are found, falls back to the current line
- **Character-based matching**: Focuses solely on open and close characters without considering syntax
- **Vanilla Vim similarity**: AnyBrackets matches the behavior of commands like `ci<`, `ci(`, etc., in vanilla Vim, including potential edge cases (like considering `>` in `=>` as a closing delimiter)
#### MiniQuotes and MiniBrackets (mini.ai behavior)
These text objects implement the behavior of the [mini.ai](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-ai.md) Neovim plugin:
- **Selection priority**: Searches the current line first before expanding outward
- **Tree-sitter integration**: Uses Tree-sitter queries for more context-aware selections
- **Syntax-aware matching**: Can distinguish between actual brackets and similar characters in other contexts (like `>` in `=>`)
#### Choosing Between Approaches
- Use **AnyQuotes/AnyBrackets** if you:
- Prefer traditional Vim behavior
- Want consistent character-based selection prioritizing innermost delimiters
- Need behavior that closely matches vanilla Vim's text objects
- Use **MiniQuotes/MiniBrackets** if you:
- Prefer the mini.ai plugin behavior
- Want more context-aware selections using Tree-sitter
- Prefer current-line priority when searching
#### Example Configuration
To use these text objects, you need to add bindings to your keymap. Here's an example configuration that makes them available when using text object operators (`i` and `a`) or change-surrounds (`cs`):
```json
{
"context": "vim_operator == a || vim_operator == i || vim_operator == cs",
"bindings": {
// Traditional Vim behavior
"q": "vim::AnyQuotes",
"b": "vim::AnyBrackets",
// mini.ai plugin behavior
"Q": "vim::MiniQuotes",
"B": "vim::MiniBrackets"
}
}
```
With this configuration, you can use commands like:
- `cib` - Change inside brackets using AnyBrackets behavior
- `cim` - Change inside brackets using MiniBrackets behavior
- `ciq` - Change inside quotes using AnyQuotes behavior
- `ciM` - Change inside quotes using MiniQuotes behavior
## Command palette
Vim mode allows you to open Zed's command palette with `:`. You can then type to access any usual Zed command. Additionally, vim mode adds aliases for popular Vim commands to ensure your muscle memory transfers to Zed. For example, you can write `:w` or `:write` to save the file.
Below, you'll find tables listing the commands you can use in the command palette. We put optional characters in square brackets to indicate that you can omit them.
> **Note**: We don't emulate the full power of Vim's command line yet. In particular, commands currently do not support arguments. Please [file issues on GitHub](https://github.com/zed-industries/zed) as you find things that are missing from the command palette.
### File and window management
This table shows commands for managing windows, tabs, and panes. As commands don't support arguments currently, you cannot specify a filename when saving or creating a new file.
| Command | Description |
| -------------- | ---------------------------------------------------- |
| `:w[rite][!]` | Save the current file |
| `:wq[!]` | Save the file and close the buffer |
| `:q[uit][!]` | Close the buffer |
| `:wa[ll][!]` | Save all open files |
| `:wqa[ll][!]` | Save all open files and close all buffers |