docs: Validate JSON snippets (settings, keymap, tasks, etc) (#40043)

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle
2025-10-12 00:19:57 -04:00
committed by GitHub
parent deef58bef7
commit abe1fd5e16
74 changed files with 849 additions and 640 deletions
+16 -16
View File
@@ -39,7 +39,7 @@ If you missed this, you can toggle vim mode on or off anytime by opening the com
> **Note**: This command toggles the following property in your user settings:
>
> ```json
> ```json [settings]
> {
> "vim_mode": true
> }
@@ -219,7 +219,7 @@ These text objects implement the behavior of the [mini.ai](https://github.com/ec
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
```json [settings]
{
"context": "vim_operator == a || vim_operator == i || vim_operator == cs",
"bindings": {
@@ -377,7 +377,7 @@ In this section, we'll learn how to customize the key bindings of Zed's vim mode
Zed's key bindings are evaluated only when the `"context"` property matches your location in the editor. For example, if you add key bindings to the `"Editor"` context, they will only work when you're editing a file. If you add key bindings to the `"Workspace"` context, they will work everywhere in Zed. Here's an example of a key binding that saves when you're editing a file:
```json
```json [settings]
{
"context": "Editor",
"bindings": {
@@ -388,12 +388,12 @@ Zed's key bindings are evaluated only when the `"context"` property matches your
Contexts are nested, so when you're editing a file, the context is the `"Editor"` context, which is inside the `"Pane"` context, which is inside the `"Workspace"` context. That's why any key bindings you add to the `"Workspace"` context will work when you're editing a file. Here's an example:
```json
```json [keymap]
// This key binding will work when you're editing a file. It comes built into Zed by default as the workspace: save command.
{
"context": "Workspace",
"bindings": {
"ctrl-s": "file::Save"
"ctrl-s": "workspace::Save"
}
}
```
@@ -419,7 +419,7 @@ Vim mode adds several contexts to the `"Editor"` context:
Here's a template with useful vim mode contexts to help you customize your vim mode key bindings. You can copy it and integrate it into your user keymap.
```json
```json [keymap]
[
{
"context": "VimControl && !menu",
@@ -458,7 +458,7 @@ By default, you can navigate between the different files open in the editor with
But you cannot use the same shortcuts to move between all the editor docks (the terminal, project panel, assistant panel, ...). If you want to use the same shortcuts to navigate to the docks, you can add the following key bindings to your user keymap.
```json
```json [settings]
{
"context": "Dock",
"bindings": {
@@ -473,7 +473,7 @@ But you cannot use the same shortcuts to move between all the editor docks (the
Subword motion, which allows you to navigate and select individual words in camelCase or snake_case, is not enabled by default. To enable it, add these bindings to your keymap.
```json
```json [settings]
{
"context": "VimControl && !menu && vim_mode != operator",
"bindings": {
@@ -487,7 +487,7 @@ Subword motion, which allows you to navigate and select individual words in came
Vim mode comes with shortcuts to surround the selection in normal mode (`ys`), but it doesn't have a shortcut to add surrounds in visual mode. By default, `shift-s` substitutes the selection (erases the text and enters insert mode). To use `shift-s` to add surrounds in visual mode, you can add the following object to your keymap.
```json
```json [settings]
{
"context": "vim_mode == visual",
"bindings": {
@@ -498,7 +498,7 @@ Vim mode comes with shortcuts to surround the selection in normal mode (`ys`), b
In non-modal text editors, cursor navigation typically wraps when moving past line ends. Zed, however, handles this behavior exactly like Vim by default: the cursor stops at line boundaries. If you prefer your cursor to wrap between lines, override these keybindings:
```json
```json [settings]
// In VimScript, this would look like this:
// set whichwrap+=<,>,[,],h,l
{
@@ -514,7 +514,7 @@ In non-modal text editors, cursor navigation typically wraps when moving past li
The [Sneak motion](https://github.com/justinmk/vim-sneak) feature allows for quick navigation to any two-character sequence in your text. You can enable it by adding the following keybindings to your keymap. By default, the `s` key is mapped to `vim::Substitute`. Adding these bindings will override that behavior, so ensure this change aligns with your workflow preferences.
```json
```json [settings]
{
"context": "vim_mode == normal || vim_mode == visual",
"bindings": {
@@ -526,7 +526,7 @@ The [Sneak motion](https://github.com/justinmk/vim-sneak) feature allows for qui
The [vim-exchange](https://github.com/tommcdo/vim-exchange) feature does not have a default binding for visual mode, as the `shift-x` binding conflicts with the default `shift-x` binding for visual mode (`vim::VisualDeleteLine`). To assign the default vim-exchange binding, add the following keybinding to your keymap:
```json
```json [settings]
{
"context": "vim_mode == visual",
"bindings": {
@@ -539,7 +539,7 @@ The [vim-exchange](https://github.com/tommcdo/vim-exchange) feature does not hav
If you're using vim mode on Linux or Windows, you may find it overrides keybindings you can't live without: `ctrl+v` to paste, `ctrl+f` to search, etc. You can restore them by copying this data into your keymap:
```json
```json [keymap]
{
"context": "Editor && !menu",
"bindings": {
@@ -572,7 +572,7 @@ You can change the following settings to modify vim mode's behavior:
Here's an example of adding a digraph for the zombie emoji. This allows you to type `ctrl-k f z` to insert a zombie emoji. You can add as many digraphs as you like.
```json
```json [settings]
{
"vim": {
"custom_digraphs": {
@@ -584,7 +584,7 @@ Here's an example of adding a digraph for the zombie emoji. This allows you to t
Here's an example of these settings changed:
```json
```json [settings]
{
"vim": {
"default_mode": "insert",
@@ -615,7 +615,7 @@ Here are a few general Zed settings that can help you fine-tune your Vim experie
Here's an example of these settings changed:
```json
```json [settings]
{
// Disable cursor blink
"cursor_blink": false,