# Code editor Vim keybindings

## About Vim keybindings

The Vi family of programs (including Vim and Neovim) are modal text editors that allow for keyboard-driven text editing. Vi-style keybindings are especially popular among developers for their speed and precision in navigating and manipulating code. Warp’s [code editor](https://docs.warp.dev/code/code-editor) now includes native support for Vim keybindings (also known as Vim mode), offering a familiar editing experience directly within your coding workflows.

### How to enable Vim Keybindings

Vim mode in the code editor uses the same setting toggle as the input editor. To enable:

* Through the [Command Palette](https://docs.warp.dev/terminal/command-palette), search for "Vim Keybindings".
* Through **Settings** > **Features** > **Text Editing**, toggle "Edit code and commands with Vim keybindings".

Unlike the input editor, the Vim implementation in the code editor starts in Normal mode.

### Customizing Keybindings

At the moment, Warp only supports default Vim keybindings.

One exception is the keyboard shortcut for exiting insert mode, which can be rebound under**Settings** > **Keyboard shortcuts** > **Exit Vim Insert Mode**, or through the [Command Palette](https://docs.warp.dev/terminal/command-palette) search for "Exit Vim Insert Mode".

## Supported Keybindings

Below is a list of the vim functionality implemented in Warp so far.

### Movement

See [Vim docs: motion](https://vimdoc.sourceforge.net/htmldoc/motion.html) for more information.

#### Basic

| Command(s)                   | Description                                         |
| ---------------------------- | --------------------------------------------------- |
| `h`, `j`, `k`, `l`           | single-char movement                                |
| `<space>`, `<backspace>`     | single-char movement with line wrap                 |
| `w`, `W`, `b`, `B`, `e`, `E` | word movement                                       |
| `ge`, `gE`                   | end of previous word                                |
| `$`                          | end of line                                         |
| `0`                          | beginning of line                                   |
| `^`                          | first non-whitespace character of line              |
| `%`                          | jump to matching bracket                            |
| `[`, `]`                     | prev/next unmatched bracket                         |
| `_`                          | beginning of the current line                       |
| `+`                          | first non-whitespace character of the next line     |
| `-`                          | first non-whitespace character of the previous line |
| `{`, `}`                     | prev/next paragraph                                 |

#### Multi-line-related

| Command(s) | Description             |
| ---------- | ----------------------- |
| `gg`, `G`  | jump to first/last line |

### Editing

| Command(s) | Description                                                 |
| ---------- | ----------------------------------------------------------- |
| `r`        | replace character under cursor                              |
| `d`, `D`   | delete a range or object                                    |
| `c`, `C`   | change a range or object (delete, then go to insert mode)   |
| `s`, `S`   | substitute (like change, but can only delete at the cursor) |
| `x`, `X`   | delete under cursor                                         |
| `y`, `Y`   | yank (copy) into the clipboard                              |
| `p`, `P`   | paste from the clipboard                                    |
| `u`, `⌃r`  | undo, redo                                                  |
| `~`        | toggle upper/lowercase under cursor                         |
| `gu`       | lowercase under cursor (`u` in visual mode)                 |
| `gU`       | uppercase under cursor (`U` in visual mode)                 |
| `J`        | join current and following lines                            |
| `.`        | repeat last edit                                            |
| `gcc`      | toggle comments on current line                             |
| `gc`       | toggle comments on visual selection                         |

See [Vim docs: editing](https://vimdoc.sourceforge.net/htmldoc/editing.html) for more information.

#### Text Objects

| Command(s)       | Description                                |
| ---------------- | ------------------------------------------ |
| `i`              | inner (exclude delimiters in text object)  |
| `a`              | around (include delimiters in text object) |
| `w`, `W`         | whitespace-delimited string (word)         |
| `"`, `'`, \`\`\` | quote-delimited string                     |
| `(`, `{`, `[`    | parenthesized/bracketed string             |

See [Vim docs: text objects](https://vimdoc.sourceforge.net/htmldoc/motion.html#text-objects) for more information.

### Search

#### Character Search

| Command(s)         | Description                                            |
| ------------------ | ------------------------------------------------------ |
| `t`, `T`, `f`, `F` | find next/prev matching character on line              |
| `;`                | repeat last character search in the same direction     |
| `,`                | repeat last character search in the opposite direction |

See [Vim docs: left-right motions](https://vimdoc.sourceforge.net/htmldoc/motion.html#f) for more information.

#### General Search

Unlike Vim, general search commands don't search within the buffer. Instead, they open Warp's native command search.

| Command(s)         | Description              |
| ------------------ | ------------------------ |
| `/`, `?`, `*`, `#` | open Warp command search |

### Mode Switching

| Command(s) | Description                                                       |
| ---------- | ----------------------------------------------------------------- |
| `i`        | insert text before the cursor                                     |
| `I`        | insert text before the first non-whitespace character in the line |
| `a`        | append text after the cursor                                      |
| `A`        | append text at the end of the line                                |
| `o`        | begin new line below the cursor and insert text                   |
| `O`        | begin new line above the cursor and insert text                   |
| `v`        | visual character mode                                             |
| `V`        | visual line mode                                                  |

See [Vim docs: insert](https://vimdoc.sourceforge.net/htmldoc/insert.html#insert) and [Vim docs: visual mode](https://vimdoc.sourceforge.net/htmldoc/visual.html#visual-mode) for more information.

### Registers

| Command(s) | Description     |
| ---------- | --------------- |
| `"`        | register prefix |

Warp currently supports the following registers:

| Register name    | Description                                                      |
| ---------------- | ---------------------------------------------------------------- |
| `a`–`z`, `A`–`Z` | named registers                                                  |
| `+`              | system clipboard                                                 |
| `*`              | system clipboard                                                 |
| `"`              | unnamed register, containing the text of the last delete or yank |

See [Vim docs: registers](https://vimdoc.sourceforge.net/htmldoc/change.html#registers) for more information.

## Feedback

The best way to report bugs and request features is through Warp's [GitHub Issues](https://github.com/warpdotdev/Warp/issues) page. Please note that the issue or request is for Vim Keybindings.
