1072 lines · 21.3 KB · Markdown
RawDownload

Configuring Zed

Folder-specific settings

Folder-specific settings are used to override Zed's global settings for files within a specific directory in the project panel. To get started, create a .zed subdirectory and add a settings.json within it. It should be noted that folder-specific settings don't need to live only a project's root, but can be defined at multiple levels in the project hierarchy. In setups like this, Zed will find the configuration nearest to the file you are working in and apply those settings to it. In most cases, this level of flexibility won't be needed and a single configuration for all files in a project is all that is required; the Zed > Settings > Open Local Settings menu action is built for this case. Running this action will look for a .zed/settings.json file at the root of the first top-level directory in your project panel. If it does not exist, it will create it.

The following global settings can be overridden with a folder-specific configuration:

  • copilot
  • enable_language_server
  • ensure_final_newline_on_save
  • format_on_save
  • formatter
  • hard_tabs
  • language_overrides
  • preferred_line_length
  • remove_trailing_whitespace_on_save
  • soft_wrap
  • tab_size
  • show_copilot_suggestions
  • show_whitespaces

See the Global settings section for details about these settings

Global settings

To get started with editing Zed's global settings, open ~/.config/zed/settings.json via ⌘ + ,, the command palette (zed: open settings), or the Zed > Settings > Open Settings application menu item.

Here are all the currently available settings.

Active Pane Magnification

  • Description: Scale by which to zoom the active pane. When set to 1.0, the active pane has the same size as others, but when set to a larger value, the active pane takes up more space.
  • Setting: active_pane_magnification
  • Default: 1.0

Options

float values

Autosave

  • Description: When to automatically save edited buffers.
  • Setting: autosave
  • Default: off

Options

  1. To disable autosave, set it to off
{
  "autosave": "off"
}
  1. To autosave when focus changes, use on_focus_change:
{
  "autosave": "on_focus_change"
}
  1. To autosave when the active window changes, use on_window_change:
{
  "autosave": "on_window_change"
}
  1. To autosave after an inactivity period, use after_delay:
{
  "autosave": {
    "after_delay": {
      "milliseconds": 1000
    }
  }
}

Auto Update

  • Description: Whether or not to automatically check for updates.
  • Setting: auto_update
  • Default: true

Options

boolean values

Buffer Font Family

  • Description: The name of a font to use for rendering text in the editor.
  • Setting: buffer_font_family
  • Default: Zed Mono

Options

The name of any font family installed on the user's system

Buffer Font Features

  • Description: The OpenType features to enable for text in the editor.
  • Setting: buffer_font_features
  • Default: null

Options

Zed supports a subset of OpenType features that can be enabled or disabled for a given buffer or terminal font. The following OpenType features can be enabled or disabled too: calt, case, cpsp, frac, liga, onum, ordn, pnum, ss01, ss02, ss03, ss04, ss05, ss06, ss07, ss08, ss09, ss10, ss11, ss12, ss13, ss14, ss15, ss16, ss17, ss18, ss19, ss20, subs, sups, swsh, titl, tnum, zero.

For example, to disable ligatures for a given font you can add the following to your settings:

{
  "buffer_font_features": {
    "calt": false
  }
}

Buffer Font Size

  • Description: The default font size for text in the editor.
  • Setting: buffer_font_size
  • Default: 15

Options

integer values

Confirm Quit

  • Description: Whether or not to prompt the user to confirm before closing the application.
  • Setting: confirm_quit
  • Default: false

Options

boolean values

Copilot

  • Description: Copilot-specific settings.
  • Setting: copilot
  • Default:
"copilot": {
  "disabled_globs": [
    ".env"
  ]
}

Options

Disabled Globs

  • Description: The set of glob patterns for which Copilot should be disabled in any matching file.
  • Setting: disabled_globs
  • Default: [".env"]

Options

List of string values

  • Description: Whether or not the cursor blinks.
  • Setting: cursor_blink
  • Default: true

Options

boolean values

Default Dock Anchor

  • Description: The default anchor for new docks.
  • Setting: default_dock_anchor
  • Default: bottom

Options

  1. Position the dock attached to the bottom of the workspace: bottom
  2. Position the dock to the right of the workspace like a side panel: right
  3. Position the dock full screen over the entire workspace: expanded

Editor Toolbar

  • Description: Whether or not to show various elements in the editor toolbar.
  • Setting: toolbar
  • Default:
"toolbar": {
  "breadcrumbs": true,
  "quick_actions": true
},

Options

Each option controls displaying of a particular toolbar element. If all elements are hidden, the editor toolbar is not displayed.

Enable Language Server

  • Description: Whether or not to use language servers to provide code intelligence.
  • Setting: enable_language_server
  • Default: true

Options

boolean values

Ensure Final Newline On Save

  • Description: Whether or not to ensure there's a single newline at the end of a buffer when saving it.
  • Setting: ensure_final_newline_on_save
  • Default: true

Options

boolean values

LSP

  • Description: Configuration for language servers.
  • Setting: lsp
  • Default: null

Options

The following settings can be overridden for specific language servers:

  • initialization_options

To override settings for a language, add an entry for that language server's name to the lsp value. Example:

"lsp": {
  "rust-analyzer": {
    "initialization_options": {
      "checkOnSave": {
        "command": "clippy" // rust-analyzer.checkOnSave.command
      }
    }
  }
}

Format On Save

  • Description: Whether or not to perform a buffer format before saving.
  • Setting: format_on_save
  • Default: on

Options

  1. on, enables format on save obeying formatter setting:
{
  "format_on_save": "on"
}
  1. off, disables format on save:
{
  "format_on_save": "off"
}

Formatter

  • Description: How to perform a buffer format.
  • Setting: formatter
  • Default: language_server

Options

  1. To use the current language server, use "language_server":
{
  "formatter": "language_server"
}
  1. Or to use an external command, use "external". Specify the name of the formatting program to run, and an array of arguments to pass to the program. The buffer's text will be passed to the program on stdin, and the formatted output should be written to stdout. For example, the following command would strip trailing spaces using sed(1):
{
  "formatter": {
    "external": {
      "command": "sed",
      "arguments": ["-e", "s/ *$//"]
    }
  }
}

Auto close

  • Description: Whether or not to automatically type closing characters for you.
  • Setting: use_autoclose
  • Default: true

Options

boolean values

Git

  • Description: Configuration for git-related features.
  • Setting: git
  • Default:
"git": {
  "git_gutter": "tracked_files"
},

Git Gutter

  • Description: Whether or not to show the git gutter.
  • Setting: git_gutter
  • Default: tracked_files

Options

  1. Show git gutter in tracked files
{
  "git_gutter": "tracked_files"
}
  1. Hide git gutter
{
  "git_gutter": "hide"
}

Hard Tabs

  • Description: Whether to indent lines using tab characters or multiple spaces.
  • Setting: hard_tabs
  • Default: false

Options

boolean values

Hover Popover Enabled

  • Description: Whether or not to show the informational hover box when moving the mouse over symbols in the editor.
  • Setting: hover_popover_enabled
  • Default: true

Options

boolean values

Inlay hints

  • Description: Configuration for displaying extra text with hints in the editor.
  • Setting: inlay_hints
  • Default:
"inlay_hints": {
  "enabled": false,
  "show_type_hints": true,
  "show_parameter_hints": true,
  "show_other_hints": true
}

Options

Inlay hints querying consists of two parts: editor (client) and LSP server. With the inlay settings above are changed to enable the hints, editor will start to query certain types of hints and react on LSP hint refresh request from the server. At this point, the server may or may not return hints depending on its implementation, further configuration might be needed, refer to the corresponding LSP server documentation.

Use lsp section for the server configuration, below are some examples for well known servers:

Rust

"lsp": {
  "rust-analyzer": {
    "initialization_options": {
      "inlayHints": {
        "maxLength": null,
        "lifetimeElisionHints": {
          "useParameterNames": true,
          "enable": "skip_trivial"
        },
        "closureReturnTypeHints": {
          "enable": "always"
        }
      }
    }
  }
}

Typescript

"lsp": {
  "typescript-language-server": {
    "initialization_options": {
      "preferences": {
        "includeInlayParameterNameHints": "all",
        "includeInlayParameterNameHintsWhenArgumentMatchesName": true,
        "includeInlayFunctionParameterTypeHints": true,
        "includeInlayVariableTypeHints": true,
        "includeInlayVariableTypeHintsWhenTypeMatchesName": false,
        "includeInlayPropertyDeclarationTypeHints": true,
        "includeInlayFunctionLikeReturnTypeHints": true,
        "includeInlayEnumMemberValueHints": true
      }
    }
  }
}

Go

"lsp": {
  "gopls": {
    "initialization_options": {
      "hints": {
        "assignVariableTypes": true,
        "compositeLiteralFields": true,
        "compositeLiteralTypes": true,
        "constantValues": true,
        "functionTypeParameters": true,
        "parameterNames": true,
        "rangeVariableTypes": true
      }
    }
  }
}

Svelte

{
  "lsp": {
    "typescript-language-server": {
      "initialization_options": {
        "preferences": {
          "includeInlayParameterNameHints": "all",
          "includeInlayParameterNameHintsWhenArgumentMatchesName": true,
          "includeInlayFunctionParameterTypeHints": true,
          "includeInlayVariableTypeHints": true,
          "includeInlayVariableTypeHintsWhenTypeMatchesName": false,
          "includeInlayPropertyDeclarationTypeHints": true,
          "includeInlayFunctionLikeReturnTypeHints": true,
          "includeInlayEnumMemberValueHints": true,
          "includeInlayEnumMemberDeclarationTypes": true
        }
      }
    }
  }
}

Journal

  • Description: Configuration for the journal.
  • Setting: journal
  • Default:
"journal": {
  "path": "~",
  "hour_format": "hour12"
}

Path

  • Description: The path of the directory where journal entries are stored.
  • Setting: path
  • Default: ~

Lines 1–500 of 1072.