# Vim mode

> Modal editing in the editor, with Vim keys in the file tree and between tabs.

Turn on Vim mode in **Settings → Editor → Vim mode**, with **editor: toggle vim**, or in `settings.json`:

```json [settings.json]
{ "editor": { "vim": true } }
```

The status bar shows the current mode on the right.

## Supported

| Area              | Keys                                                                    |
| ----------------- | ----------------------------------------------------------------------- |
| Modes             | Normal, Insert, Visual, Visual line                                     |
| Motions           | `h j k l 0 ^ $ _ g_ \| + -`, `w b e W B E ge gE`, `( ) { } %`, `gg G H M L`, `f t F T ; ,` |
| Search            | `/ ? n N * #`                                                           |
| Operators         | `d c y > < gu gU g~`, with counts such as `2d3w`                        |
| Text objects      | `iw aw iW aW is as ip ap`, quotes, brackets, `b`, `B`                   |
| Editing           | `i a I A o O x X s S r D C J gJ ~ p P Y gp gP gi`, `ctrl-a ctrl-x`      |
| Undo and repeat   | `u ctrl-r U .`                                                          |
| Registers         | `"a` to `"z`, uppercase appends. The unnamed register is the system clipboard. |
| Marks             | `m{a-z}`, `` ` `` and `'`                                               |
| Jumps and changes | `ctrl-o ctrl-i g; g,`                                                   |
| Scrolling         | `ctrl-e ctrl-y ctrl-d ctrl-u ctrl-f ctrl-b zz zt zb`                    |

## Workspace keys

| Keys                    | Action                         |
| ----------------------- | ------------------------------ |
| `gt` / `gT`             | Next / previous tab            |
| `ctrl-w v`              | Add a pane column              |
| `ctrl-w c`, `ctrl-w q`  | Close the pane                 |
| `ctrl-^`, `ctrl-6`      | Previously used tab            |
| `gd`, `ctrl-]`          | Go to definition               |
| `gD`                    | Go to declaration              |
| `gy`                    | Go to type definition          |
| `gI`, `gri`             | Go to implementation           |
| `K`                     | Hover information              |

In the Files panel, `h j k l` move, `R` renames, `D` deletes, `]c` and `[c` jump between changed files, and `{` and `}` jump between folders.

## Remap keys

Bind keys to `editor::VimKeys` in [`keymap.json`](/docs/customize/keyboard-shortcuts#in-keymapjson). Every mapping behaves like `noremap`.

```json [keymap.json]
[
  {
    "context": "Editor && vim_mode == normal && vim_idle",
    "bindings": { "space space": ["editor::VimKeys", "zz"] }
  }
]
```

## Not supported

- Macros (`q`, `@`) and the `:` command line, including `:w`.
- Visual block and Replace modes.
- Folding keys, `gc`, `ctrl-w h/j/k/l/s/o`, `]d` and `[d`, `gf`, `gx`, `ZZ`.
- Uppercase marks, numbered registers, and the `it` / `at` tag objects.
