配置 Zed
Zed 旨在进行配置:我们希望完全适合您的工作流程和偏好。 我们提供默认设置,旨在为尽可能多的人提供一个舒适的起点,但我们希望您会喜欢调整它,使其感觉棒极了。
除了此处描述的设置外,您可能还想更改您的 主题、配置您的 快捷键绑定、设置 任务 或安装 扩展。
设置文件
可以使用 ctrl-, 打开您的设置文件。 默认情况下,它位于 ~/.config/zed/settings.json
,但如果您在 Linux 上的环境中设置了 XDG_CONFIG_HOME,它将位于 $XDG_CONFIG_HOME/zed/settings.json
。
此配置与您项目中的任何本地配置合并。 您可以通过从命令面板运行 zed: 打开项目设置
来打开项目设置。 这将创建一个包含 .zed/settings.json
的 .zed
目录。
虽然大多数项目只需要根目录中的一个设置文件,但您可以根据需要为子目录添加更多本地设置文件。 并非所有设置都可以在本地文件中设置,只有那些会影响编辑器和语言工具行为的设置。 例如,您可以设置 tab_size
、formatter
等,但不能设置 theme
、vim_mode
等。
配置文件语法是 JSON 的超集,允许 //
注释。
默认设置
您可以通过从命令面板运行 zed: 打开默认设置
来查找当前 Zed 的默认设置。
提供语言服务器的扩展程序也可以为这些语言服务器提供默认设置。
设置
活动面板修饰符
- 描述:应用于活动面板的样式设置。
- 设置:
active_pane_modifiers
- 默认
{
"active_pane_modifiers": {
"magnification": 1.0,
"border_size": 0.0,
"inactive_opacity": 1.0
}
}
放大
- 描述:用于缩放活动面板的比例。 当设置为
1.0
时,活动面板的大小与其他面板相同,但当设置为更大的值时,活动面板会占用更多空间。 - 设置:
magnification
- 默认值:
1.0
选项
float
值
边框大小
- 描述:活动面板周围边框的大小。 当设置为 0 时,活动面板没有任何边框。 边框是内嵌绘制的。
- 设置:
border_size
- 默认值:
0.0
选项
非负 float
值
非活动不透明度
- 描述:非活动面板的不透明度。 当设置为 1.0 时,非活动面板与活动面板具有相同的不透明度。 如果设置为 0,则完全看不到非活动面板的内容。 值被限制在 [0.0, 1.0] 范围内。
- 设置:
inactive_opacity
- 默认值:
1.0
选项
float
值
底部停靠栏布局
- 描述:控制底部停靠栏相对于左右停靠栏的布局
- 设置:
bottom_dock_layout
- 默认值:
"contained"
选项
- 包含底部停靠栏,为左右停靠栏提供窗口的完整高度
{
"bottom_dock_layout": "contained"
}
- 为底部停靠栏提供窗口的完整宽度,截断左右停靠栏
{
"bottom_dock_layout": "full"
}
- 左对齐底部停靠栏,截断左侧停靠栏,并为右侧停靠栏提供窗口的完整高度
{
"bottom_dock_layout": "left_aligned"
}
- 右对齐底部停靠栏,为左侧停靠栏提供窗口的完整高度,并截断右侧停靠栏。
{
"bottom_dock_layout": "right_aligned"
}
自动安装扩展
- 描述:定义要自动安装或永不安装的扩展。
- 设置:
auto_install_extension
- 默认值:
{ "html": true }
选项
您可以通过列出 扩展安装位置 下的子文件夹来查找当前安装的扩展的名称
在 MacOS 上
ls ~/Library/Application\ Support/Zed/extensions/installed/
在 Linux 上
ls ~/.local/share/zed/extensions/installed
定义应该安装 (true
) 或永不安装 (false
) 的扩展。
{
"auto_install_extensions": {
"html": true,
"dockerfile": true,
"docker-compose": false
}
}
自动保存
- 描述:何时自动保存已编辑的缓冲区。
- 设置:
autosave
- 默认值:
off
选项
- 要禁用自动保存,请将其设置为
off
{
"autosave": "off"
}
- 要在焦点改变时自动保存,请使用
on_focus_change
{
"autosave": "on_focus_change"
}
- 要在活动窗口改变时自动保存,请使用
on_window_change
{
"autosave": "on_window_change"
}
- 要在不活动一段时间后自动保存,请使用
after_delay
{
"autosave": {
"after_delay": {
"milliseconds": 1000
}
}
}
启动时恢复
- 描述:控制启动时会话的恢复。
- 设置:
restore_on_startup
- 默认值:
last_session
选项
- 恢复退出 Zed 时打开的所有工作区
{
"restore_on_startup": "last_session"
}
- 恢复上次关闭的工作区
{
"restore_on_startup": "last_workspace"
}
- 始终从空编辑器开始
{
"restore_on_startup": "none"
}
点击时自动滚动
- 描述:单击可见文本区域边缘附近时是否滚动。
- 设置:
autoscroll_on_clicks
- 默认值:
false
选项
boolean
值
自动更新
- 描述:是否自动检查更新。
- 设置:
auto_update
- 默认值:
true
选项
boolean
值
基本键盘映射
- 描述:基本键盘绑定方案。 可以使用用户键盘映射覆盖基本键盘映射。
- 设置:
base_keymap
- 默认值:
VSCode
选项
- VSCode
{
"base_keymap": "VSCode"
}
- Atom
{
"base_keymap": "Atom"
}
- JetBrains
{
"base_keymap": "JetBrains"
}
- 无
{
"base_keymap": "None"
}
- SublimeText
{
"base_keymap": "SublimeText"
}
- TextMate
{
"base_keymap": "TextMate"
}
缓冲区字体系列
- 描述:用于在编辑器中渲染文本的字体名称。
- 设置:
buffer_font_family
- 默认值:
Zed Plex Mono
选项
用户系统上安装的任何字体系列的名称
缓冲区字体功能
- 描述:为编辑器中的文本启用的 OpenType 功能。
- 设置:
buffer_font_features
- 默认值:
null
- 平台:macOS 和 Windows。
选项
Zed 支持所有可以为给定的缓冲区或终端字体启用或禁用的 OpenType 功能,以及为字体功能设置值。
例如,要禁用字体连字,请将以下内容添加到您的设置中
{
"buffer_font_features": {
"calt": false
}
}
您还可以设置其他 OpenType 功能,例如将 cv01
设置为 7
{
"buffer_font_features": {
"cv01": 7
}
}
缓冲区字体后备
- 描述:设置缓冲区文本的字体后备,这会与平台的默认后备合并。
- 设置:
buffer_font_fallbacks
- 默认值:
null
- 平台:macOS 和 Windows。
选项
例如,要使用 Nerd Font
作为后备,请将以下内容添加到您的设置中
{
"buffer_font_fallbacks": ["Nerd Font"]
}
缓冲区字体大小
- 描述:编辑器中文本的默认字体大小。
- 设置:
buffer_font_size
- 默认值:
15
选项
从 6
到 100
像素(包括)的 integer
值
缓冲区字体粗细
- 描述:编辑器中文本的默认字体粗细。
- 设置:
buffer_font_weight
- 默认值:
400
选项
介于 100
和 900
之间的 integer
值
缓冲区行高
- 描述:编辑器中文本的默认行高。
- 设置:
buffer_line_height
- 默认值:
"comfortable"
选项
"standard"
, "comfortable"
或 { "custom": float }
(1
是紧凑的,2
是松散的)
确认退出
- 描述:是否提示用户在关闭应用程序之前进行确认。
- 设置:
confirm_quit
- 默认值:
false
选项
boolean
值
居中布局
- 描述:居中布局模式的配置。
- 设置:
centered_layout
- 默认
"centered_layout": {
"left_padding": 0.2,
"right_padding": 0.2,
}
选项
left_padding
和 right_padding
选项定义了激活居中布局模式时,中央面板左右填充相对于工作区的宽度。 有效值范围为 0
到 0.4
。
Direnv 集成
- 描述:用于 direnv 集成的设置。需要安装
direnv
。direnv
集成使得可以使用direnv
配置设置的环境变量来检测$PATH
中的一些语言服务器,而不是安装它们。它还允许在任务中使用这些环境变量。 - 设置:
load_direnv
- 默认值:
"direct"
选项
有两个选项可供选择
shell_hook
:使用 shell hook 来加载 direnv。这依赖于 direnv 在进入目录时激活。支持 POSIX shell 和 fish。direct
:使用direnv export json
来加载 direnv。这将直接加载 direnv 而不依赖于 shell hook,可能会导致一些不一致。这允许 direnv 与任何 shell 一起工作。
编辑预测
- 描述:编辑预测的设置。
- 设置:
edit_predictions
- 默认
"edit_predictions": {
"disabled_globs": [
"**/.env*",
"**/*.pem",
"**/*.key",
"**/*.cert",
"**/*.crt",
"**/.dev.vars",
"**/secrets.yml"
]
}
选项
禁用 Globs
- 描述:应禁用编辑预测的 globs 列表。此列表会添加到预先存在的合理默认 globs 集合中。您添加的任何其他 globs 都会与它们组合在一起。
- 设置:
disabled_globs
- 默认值:
["**/.env*", "**/*.pem", "**/*.key", "**/*.cert", "**/*.crt", "**/.dev.vars", "**/secrets.yml"]
选项
string
值的列表。
编辑预测禁用于
- 描述:应禁用编辑预测的语言范围列表。
- 设置:
edit_predictions_disabled_in
- 默认值:
[]
选项
string
值的列表
- 不要在注释中显示编辑预测
"disabled_in": ["comment"]
- 不要在字符串和注释中显示编辑预测
"disabled_in": ["comment", "string"]
- 仅在 Go 中,不要在字符串和注释中显示编辑预测
{
"languages": {
"Go": {
"edit_predictions_disabled_in": ["comment", "string"]
}
}
}
当前行高亮
- 描述:如何在编辑器中高亮显示当前行。
- 设置:
current_line_highlight
- 默认值:
all
选项
- 不高亮显示当前行
"current_line_highlight": "none"
- 高亮显示装订线区域
"current_line_highlight": "gutter"
- 高亮显示编辑器区域
"current_line_highlight": "line"
- 高亮显示整行
"current_line_highlight": "all"
选择高亮
- 描述:是否高亮显示编辑器中所有出现的所选文本。
- 设置:
selection_highlight
- 默认值:
true
LSP 高亮防抖
- 描述:基于当前光标位置从语言服务器查询高亮之前的防抖延迟。
- 设置:
lsp_highlight_debounce
- 默认值:
75
光标闪烁
- 描述:光标是否闪烁。
- 设置:
cursor_blink
- 默认值:
true
选项
boolean
值
光标形状
- 描述:默认编辑器的光标形状。
- 设置:
cursor_shape
- 默认值:
bar
选项
- 垂直条
"cursor_shape": "bar"
- 环绕后续字符的块
"cursor_shape": "block"
- 沿着后续字符运行的下划线
"cursor_shape": "underline"
- 围绕后续字符绘制的框
"cursor_shape": "hollow"
隐藏鼠标
- 描述:确定何时在编辑器或输入框中隐藏鼠标光标。
- 设置:
hide_mouse
- 默认值:
on_typing_and_movement
选项
- 从不隐藏鼠标光标
"hide_mouse": "never"
- 仅在键入时隐藏
"hide_mouse": "on_typing"
- 在键入和光标移动时都隐藏
"hide_mouse": "on_typing_and_movement"
代码片段排序顺序
- 描述:确定代码片段相对于其他完成项的排序方式。
- 设置:
snippet_sort_order
- 默认值:
inline
选项
- 将代码片段放在完成列表的顶部
"snippet_sort_order": "top"
- 正常放置代码片段,没有任何偏好
"snippet_sort_order": "inline"
- 将代码片段放在完成列表的底部
"snippet_sort_order": "bottom"
编辑器滚动条
- 描述:是否显示编辑器滚动条以及其中的各种元素。
- 设置:
scrollbar
- 默认
"scrollbar": {
"show": "auto",
"cursors": true,
"git_diff": true,
"search_results": true,
"selected_text": true,
"selected_symbol": true,
"diagnostics": "all",
"axes": {
"horizontal": true,
"vertical": true,
},
},
显示模式
- 描述:何时显示编辑器滚动条。
- 设置:
show
- 默认值:
auto
选项
- 如果存在重要信息,则显示滚动条,或遵循系统配置的行为
"scrollbar": {
"show": "auto"
}
- 匹配系统配置的行为
"scrollbar": {
"show": "system"
}
- 始终显示滚动条
"scrollbar": {
"show": "always"
}
- 从不显示滚动条
"scrollbar": {
"show": "never"
}
光标指示器
- 描述:是否在滚动条中显示光标位置。
- 设置:
cursors
- 默认值:
true
选项
boolean
值
Git 差异指示器
- 描述:是否在滚动条中显示 git 差异指示器。
- 设置:
git_diff
- 默认值:
true
选项
boolean
值
搜索结果指示器
- 描述:是否在滚动条中显示缓冲区搜索结果。
- 设置:
search_results
- 默认值:
true
选项
boolean
值
选定文本指示器
- 描述:是否在滚动条中显示选定文本出现的位置。
- 设置:
selected_text
- 默认值:
true
选项
boolean
值
选定符号指示器
- 描述:是否在滚动条中显示选定符号出现的位置。
- 设置:
selected_symbol
- 默认值:
true
选项
boolean
值
诊断
- 描述:要在滚动条中显示哪些诊断指示器。
- 设置:
diagnostics
- 默认值:
all
选项
- 显示所有诊断信息
{
"diagnostics": "all"
}
- 不显示任何诊断信息
{
"diagnostics": "none"
}
- 仅显示错误
{
"diagnostics": "error"
}
- 仅显示错误和警告
{
"diagnostics": "warning"
}
- 仅显示错误、警告和信息
{
"diagnostics": "information"
}
轴
- 描述:强制启用或禁用每个轴的滚动条
- 设置:
axes
- 默认
"scrollbar": {
"axes": {
"horizontal": true,
"vertical": true,
},
}
水平
- 描述:为 false 时,强制禁用水平滚动条。否则,遵循其他设置。
- 设置:
horizontal
- 默认值:
true
选项
boolean
值
垂直
- 描述:为 false 时,强制禁用垂直滚动条。否则,遵循其他设置。
- 设置:
vertical
- 默认值:
true
选项
boolean
值
编辑器选项卡栏
- 描述:与编辑器的选项卡栏相关的设置。
- 设置:
tab_bar
- 默认
"tab_bar": {
"show": true,
"show_nav_history_buttons": true,
"show_tab_bar_buttons": true
}
显示
- 描述:是否在编辑器中显示选项卡栏。
- 设置:
show
- 默认值:
true
选项
boolean
值
导航历史记录按钮
- 描述:是否显示导航历史记录按钮。
- 设置:
show_nav_history_buttons
- 默认值:
true
选项
boolean
值
选项卡栏按钮
- 描述:是否显示选项卡栏按钮。
- 设置:
show_tab_bar_buttons
- 默认值:
true
选项
boolean
值
编辑器选项卡
- 描述:编辑器选项卡的配置。
- 设置:
tabs
- 默认
"tabs": {
"close_position": "right",
"file_icons": false,
"git_status": false,
"activate_on_close": "history",
"show_close_button": "hover",
"show_diagnostics": "off"
},
关闭位置
- 描述:在选项卡中显示关闭按钮的位置。
- 设置:
close_position
- 默认值:
right
选项
- 在右侧显示关闭按钮
{
"close_position": "right"
}
- 在左侧显示关闭按钮
{
"close_position": "left"
}
文件图标
- 描述:是否显示选项卡的文件图标。
- 设置:
file_icons
- 默认值:
false
Git 状态
- 描述:是否在选项卡中显示 Git 文件状态。
- 设置:
git_status
- 默认值:
false
关闭时激活
- 描述:关闭当前选项卡后要做什么。
- 设置:
activate_on_close
- 默认值:
history
选项
- 激活先前打开的选项卡
{
"activate_on_close": "history"
}
- 如果存在,则激活右侧相邻的选项卡
{
"activate_on_close": "neighbour"
}
- 如果存在,则激活左侧相邻的选项卡
{
"activate_on_close": "left_neighbour"
}
显示关闭按钮
- 描述:控制选项卡关闭按钮的外观行为。
- 设置:
show_close_button
- 默认值:
hover
选项
- 仅在悬停在选项卡上时显示它
{
"show_close_button": "hover"
}
- 持续显示它
{
"show_close_button": "always"
}
- 即使悬停也不显示它
{
"show_close_button": "hidden"
}
显示诊断信息
- 描述:是否在选项卡中显示诊断指示器。此设置仅在文件图标处于活动状态时才有效,并控制标记哪些具有诊断问题的文件。
- 设置:
show_diagnostics
- 默认值:
off
选项
- 不标记任何文件
{
"show_diagnostics": "off"
}
- 仅标记具有错误的文件
{
"show_diagnostics": "errors"
}
- 标记具有错误和警告的文件
{
"show_diagnostics": "all"
}
编辑器工具栏
- 描述:是否显示编辑器工具栏中的各种元素。
- 设置:
toolbar
- 默认
"toolbar": {
"breadcrumbs": true,
"quick_actions": true,
"selections_menu": true
},
选项
每个选项控制特定工具栏元素的显示。如果所有元素都被隐藏,则不显示编辑器工具栏。
启用语言服务器
- 描述:是否使用语言服务器来提供代码智能。
- 设置:
enable_language_server
- 默认值:
true
选项
boolean
值
保存时确保最终换行符
- 描述:删除文件末尾包含仅包含空格的任何行,并确保末尾只有一个换行符。
- 设置:
ensure_final_newline_on_save
- 默认值:
true
选项
boolean
值
LSP
- 描述:语言服务器的配置。
- 设置:
lsp
- 默认值:
null
选项
以下设置可以针对特定语言服务器进行覆盖
initialization_options
settings
要覆盖语言服务器的配置,请将该语言服务器名称的条目添加到 lsp
值。
某些选项通过 initialization_options
传递给语言服务器。这些用于必须在语言服务器启动时指定的选项,并且更改时需要重新启动语言服务器。
例如,要将 check
选项传递给 rust-analyzer
,请使用以下配置
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"command": "clippy" // rust-analyzer.check.command (default: "check")
}
}
}
}
而其他选项可能会在运行时更改,应放在 settings
下
"lsp": {
"yaml-language-server": {
"settings": {
"yaml": {
"keyOrdering": true // Enforces alphabetical ordering of keys in maps
}
}
}
}
LSP 高亮防抖
- 描述:基于当前光标位置从语言服务器查询高亮之前的防抖延迟(以毫秒为单位)。
- 设置:
lsp_highlight_debounce
- 默认值:
75
选项
表示毫秒的 integer
值
保存时格式化
- 描述:是否在保存之前执行缓冲区格式化。
- 设置:
format_on_save
- 默认值:
on
选项
on
,启用保存时格式化,服从formatter
设置
{
"format_on_save": "on"
}
off
,禁用保存时格式化
{
"format_on_save": "off"
}
格式化器
- 描述:如何执行缓冲区格式化。
- 设置:
formatter
- 默认值:
auto
选项
- 要使用当前的语言服务器,请使用
"language_server"
{
"formatter": "language_server"
}
- 或者要使用外部命令,请使用
"external"
。指定要运行的格式化程序的名称,以及要传递给程序的参数数组。缓冲区的文本将通过 stdin 传递给程序,并且格式化的输出应写入 stdout。例如,以下命令将使用sed(1)
删除尾随空格
{
"formatter": {
"external": {
"command": "sed",
"arguments": ["-e", "s/ *$//"]
}
}
}
- 外部格式化程序可以选择包含
{buffer_path}
占位符,该占位符在运行时将包含正在格式化的缓冲区的路径。格式化程序通过标准输入接收文件内容,重新格式化它,然后将其输出到标准输出,因此通常不知道它们正在格式化的文件的文件名。像 prettier 这样的工具支持通过命令行参数接收文件路径,然后可以使用该路径来影响格式化决策。
警告:{buffer_path}
不应用于指示您的格式化程序从文件名读取。您的格式化程序应仅从标准输入读取,而不应直接读取或写入文件。
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}"]
}
}
- 或者要使用连接的语言服务器提供的代码操作,请使用
"code_actions"
{
"formatter": {
"code_actions": {
// Use ESLint's --fix:
"source.fixAll.eslint": true,
// Organize imports on save:
"source.organizeImports": true
}
}
}
- 或者要连续使用多个格式化器,请使用格式化器数组
{
"formatter": [
{ "language_server": { "name": "rust-analyzer" } },
{
"external": {
"command": "sed",
"arguments": ["-e", "s/ *$//"]
}
}
]
}
在这里,rust-analyzer
将首先用于格式化代码,然后调用 sed。如果任何一个格式化程序失败,后续的格式化程序仍然会执行。
格式化时的代码操作
- 描述:在格式化缓冲区时与主语言服务器一起执行的代码操作。
- 设置:
code_actions_on_format
- 默认值:
{}
,除了 Go 是{ "source.organizeImports": true }
示例
- 在 TypeScript 和 TSX 缓冲区中格式化时组织导入
{
"languages": {
"TypeScript": {
"code_actions_on_format": {
"source.organizeImports": true
}
},
"TSX": {
"code_actions_on_format": {
"source.organizeImports": true
}
}
}
}
- 格式化时运行 ESLint
fixAll
代码操作
{
"languages": {
"JavaScript": {
"code_actions_on_format": {
"source.fixAll.eslint": true
}
}
}
}
- 使用
fixAll
时仅运行单个 ESLint 规则
{
"languages": {
"JavaScript": {
"code_actions_on_format": {
"source.fixAll.eslint": true
}
}
},
"lsp": {
"eslint": {
"settings": {
"codeActionOnSave": {
"rules": ["import/order"]
}
}
}
}
}
自动关闭
- 描述:输入左括号、方括号、花括号、单引号或双引号时,是否自动添加匹配的右侧字符。
- 设置:
use_autoclose
- 默认值:
true
选项
boolean
值
始终将括号视为自动闭合
- 描述:控制编辑器如何处理自动闭合的字符。
- 设置:
always_treat_brackets_as_autoclosed
- 默认值:
false
选项
boolean
值
示例
如果该设置设置为 true
- 在编辑器中输入:
)))
- 将光标移动到开头:
^)))
- 再次输入:
)))
结果仍然是 )))
而不是默认情况下的 ))))))
。
文件扫描排除项
- 设置:
file_scan_exclusions
- 描述:Zed 将完全排除的文件或文件全局模式。它们将在文件扫描、文件搜索期间被跳过,并且不会显示在项目文件树中。覆盖
file_scan_inclusions
。 - 默认
"file_scan_exclusions": [
"**/.git",
"**/.svn",
"**/.hg",
"**/.jj",
"**/CVS",
"**/.DS_Store",
"**/Thumbs.db",
"**/.classpath",
"**/.settings"
],
注意,在 settings.json 中指定 file_scan_exclusions
将覆盖默认值(如上所示)。 如果您希望排除其他项目,您需要包含设置中的所有默认值。
文件扫描包含项
- 设置:
file_scan_inclusions
- 描述:Zed 将包含的文件或文件全局模式,即使它们被 git 忽略。 这对于未被 git 跟踪但对您的项目仍然重要的文件很有用。 请注意,过于宽泛的全局模式会减慢 Zed 的文件扫描速度。
file_scan_exclusions
优先于这些包含项。 - 默认
"file_scan_inclusions": [".env*"],
文件类型
- 设置:
file_types
- 描述:配置 Zed 如何根据文件名或扩展名选择文件的语言。 支持全局模式条目。
- 默认
"file_types": {
"JSONC": ["**/.zed/**/*.json", "**/zed/**/*.json", "**/Zed/**/*.json", "**/.vscode/**/*.json"],
"Shell Script": [".env.*"]
}
示例
要将所有 .c
文件解释为 C++,将名为 MyLockFile
的文件解释为 TOML,并将以 Dockerfile
开头的文件解释为 Dockerfile
{
"file_types": {
"C++": ["c"],
"TOML": ["MyLockFile"],
"Dockerfile": ["Dockerfile*"]
}
}
诊断
- 描述:与诊断相关的功能的配置。
- 设置:
diagnostics
- 默认
{
"diagnostics": {
"include_warnings": true,
"inline": {
"enabled": false
},
"update_with_cursor": false,
"primary_only": false,
"use_rendered": false
}
}
内联诊断
- 描述:是否以内联方式显示诊断信息。
- 设置:
inline
- 默认
{
"diagnostics": {
"inline": {
"enabled": false,
"update_debounce_ms": 150,
"padding": 4,
"min_column": 0,
"max_severity": null
}
}
}
选项
- 启用内联诊断。
{
"diagnostics": {
"inline": {
"enabled": true
}
}
}
- 延迟诊断更新,直到上次诊断更新后的一段时间。
{
"diagnostics": {
"inline": {
"enabled": true,
"update_debounce_ms": 150
}
}
}
- 设置源代码行尾和诊断信息开始之间的填充。
{
"diagnostics": {
"inline": {
"enabled": true,
"padding": 4
}
}
}
- 在给定的列处水平对齐内联诊断信息。
{
"diagnostics": {
"inline": {
"enabled": true,
"min_column": 80
}
}
}
- 仅显示警告和错误诊断信息。
{
"diagnostics": {
"inline": {
"enabled": true,
"max_severity": "warning"
}
}
}
Git
- 描述:与 git 相关的功能的配置。
- 设置:
git
- 默认
{
"git": {
"git_gutter": "tracked_files",
"inline_blame": {
"enabled": true
},
"hunk_style": "staged_hollow"
}
}
Git 提示条
- 描述:是否显示 git 提示条。
- 设置:
git_gutter
- 默认值:
tracked_files
选项
- 在跟踪的文件中显示 git 提示条
{
"git": {
"git_gutter": "tracked_files"
}
}
- 隐藏 git 提示条
{
"git": {
"git_gutter": "hide"
}
}
提示条去抖动
- 描述:设置在 git 提示条中反映更改之前的去抖动阈值(以毫秒为单位)。
- 设置:
gutter_debounce
- 默认值:
null
选项
表示毫秒的 integer
值
示例
{
"git": {
"gutter_debounce": 100
}
}
内联 Git 追溯
- 描述:是否在当前聚焦的行上以内联方式显示 git 追溯信息。
- 设置:
inline_blame
- 默认
{
"git": {
"inline_blame": {
"enabled": true
}
}
}
代码块样式
- 描述:我们应该使用什么样式来显示差异代码块。
- 设置:
hunk_style
- 默认
{
"git": {
"hunk_style": "staged_hollow"
}
}
选项
- 显示淡出并带有边框的已暂存代码块
{
"git": {
"hunk_style": "staged_hollow"
}
}
- 显示淡出并带有边框的未暂存代码块
{
"git": {
"hunk_style": "unstaged_hollow"
}
}
选项
- 禁用内联 git 追溯
{
"git": {
"inline_blame": {
"enabled": false
}
}
}
- 仅在延迟后显示内联 git 追溯(光标停止移动后开始)
{
"git": {
"inline_blame": {
"enabled": true,
"delay_ms": 500
}
}
}
- 在提交日期和作者旁边显示提交摘要
{
"git": {
"inline_blame": {
"enabled": true,
"show_commit_summary": true
}
}
}
- 以此作为显示内联追溯信息的最小列
{
"git": {
"inline_blame": {
"enabled": true,
"min_column": 80
}
}
}
缩进参考线
- 描述:与缩进参考线相关的配置。 可以为每种语言单独配置缩进参考线。
- 设置:
indent_guides
- 默认
{
"indent_guides": {
"enabled": true,
"line_width": 1,
"active_line_width": 1,
"coloring": "fixed",
"background_coloring": "disabled"
}
}
选项
- 禁用缩进参考线
{
"indent_guides": {
"enabled": false
}
}
- 为特定语言启用缩进参考线。
{
"languages": {
"Python": {
"indent_guides": {
"enabled": true
}
}
}
}
- 启用缩进感知着色(“彩虹缩进”)。 用于不同缩进级别的颜色在主题中定义(主题键:
accents
)。 它们可以通过使用主题覆盖进行自定义。
{
"indent_guides": {
"enabled": true,
"coloring": "indent_aware"
}
}
- 启用缩进感知背景着色(“彩虹缩进”)。 用于不同缩进级别的颜色在主题中定义(主题键:
accents
)。 它们可以通过使用主题覆盖进行自定义。
{
"indent_guides": {
"enabled": true,
"coloring": "indent_aware",
"background_coloring": "indent_aware"
}
}
硬制表符
- 描述:是否使用制表符或多个空格来缩进行。
- 设置:
hard_tabs
- 默认值:
false
选项
boolean
值
悬停弹出框已启用
- 描述:在编辑器中将鼠标移动到符号上时,是否显示信息悬停框。
- 设置:
hover_popover_enabled
- 默认值:
true
选项
boolean
值
图标主题
- 描述:图标主题设置可以以两种形式指定 - 作为图标主题的名称,或者作为包含 Zed 中文件/文件夹的
mode
、dark
和light
图标主题的对象。 - 设置:
icon_theme
- 默认值:
Zed (Default)
图标主题对象
- 描述:使用包含
mode
、dark
和light
的对象指定图标主题。 - 设置:
icon_theme
- 默认
"icon_theme": {
"mode": "system",
"dark": "Zed (Default)",
"light": "Zed (Default)"
},
模式
- 描述:指定图标主题模式。
- 设置:
mode
- 默认值:
system
选项
- 将图标主题设置为深色模式
{
"mode": "dark"
}
- 将图标主题设置为浅色模式
{
"mode": "light"
}
- 将图标主题设置为系统模式
{
"mode": "system"
}
深色
- 描述:深色图标主题的名称。
- 设置:
dark
- 默认值:
Zed (Default)
选项
在命令面板中运行 icon theme selector: toggle
操作以查看当前有效图标主题名称的列表。
浅色
- 描述:浅色图标主题的名称。
- 设置:
light
- 默认值:
Zed (Default)
选项
在命令面板中运行 icon theme selector: toggle
操作以查看当前有效图标主题名称的列表。
内嵌提示
- 描述:用于在编辑器中显示带有提示的额外文本的配置。
- 设置:
inlay_hints
- 默认
"inlay_hints": {
"enabled": false,
"show_type_hints": true,
"show_parameter_hints": true,
"show_other_hints": true,
"show_background": false,
"edit_debounce_ms": 700,
"scroll_debounce_ms": 50,
"toggle_on_modifiers_press": null
}
选项
内嵌提示查询包含两个部分:编辑器(客户端)和 LSP 服务器。 将以上内嵌设置更改为启用提示后,编辑器将开始查询某些类型的提示并响应来自服务器的 LSP 提示刷新请求。 此时,服务器可能会或可能不会返回提示,具体取决于其实现,可能需要进一步配置,请参阅相应的 LSP 服务器文档。
以下语言已由 Zed 预配置内嵌提示
使用 lsp
部分进行服务器配置。 相应的语言文档中提供了示例。
提示不会立即在 Zed 中查询,使用两种去抖动,都可以设置为 0 以禁用。 与设置相关的提示更新不会去抖动。
toggle_on_modifiers_press
的所有可能的配置值为
"inlay_hints": {
"toggle_on_modifiers_press": {
"control": true,
"shift": true,
"alt": true,
"platform": true,
"function": true
}
}
未指定的值具有 false
值,如果所有修饰符均为 false
或未按下所有修饰符,则不会切换提示。
日记
- 描述:日记的配置。
- 设置:
journal
- 默认
"journal": {
"path": "~",
"hour_format": "hour12"
}
路径
- 描述:存储日记条目的目录的路径。
- 设置:
path
- 默认值:
~
选项
string
值
小时格式
- 描述:用于在日记中显示小时的格式。
- 设置:
hour_format
- 默认值:
hour12
选项
- 12 小时制格式
{
"hour_format": "hour12"
}
- 24 小时制格式
{
"hour_format": "hour24"
}
语言
- 描述:特定语言的配置。
- 设置:
languages
- 默认值:
null
选项
要覆盖某种语言的设置,请将该语言名称的条目添加到 languages
值中。 示例
"languages": {
"C": {
"format_on_save": "off",
"preferred_line_length": 64,
"soft_wrap": "preferred_line_length"
},
"JSON": {
"tab_size": 4
}
}
以下设置可以为每种特定语言覆盖
enable_language_server
ensure_final_newline_on_save
format_on_save
formatter
hard_tabs
preferred_line_length
remove_trailing_whitespace_on_save
show_edit_predictions
show_whitespaces
soft_wrap
tab_size
use_autoclose
always_treat_brackets_as_autoclosed
这些值采用与同名的根级别设置相同的选项。
网络代理
- 描述:配置 Zed 的网络代理。
- 设置:
proxy
- 默认值:
null
选项
代理设置必须包含代理的 URL。
支持以下 URI 方案
http
https
socks4
- 具有本地 DNS 的 SOCKS4 代理socks4a
- 具有远程 DNS 的 SOCKS4 代理socks5
- 具有本地 DNS 的 SOCKS5 代理socks5h
- 具有远程 DNS 的 SOCKS5 代理
未指定方案时,将使用 http
。
默认情况下,不使用任何代理,或者 Zed 将尝试从环境变量(例如 http_proxy
、HTTP_PROXY
、https_proxy
、HTTPS_PROXY
、all_proxy
、ALL_PROXY
)检索代理设置。
例如,要设置 http
代理,请将以下内容添加到您的设置中
{
"proxy": "http://127.0.0.1:10809"
}
或者设置 socks5
代理
{
"proxy": "socks5h://localhost:10808"
}
预览标签页
-
描述:预览标签页允许您在预览模式下打开文件,当您切换到另一个文件时,它们会自动关闭,除非您明确地固定它们。 这对于快速查看文件而不使您的工作区混乱很有用。 预览标签页以斜体显示其文件名。
有几种方法可以将预览标签页转换为常规标签页- 双击文件
- 双击标签页标题
- 使用
project_panel::OpenPermanent
操作 - 编辑文件
- 将文件拖到不同的窗格
-
设置:
preview_tabs
-
默认
"preview_tabs": {
"enabled": true,
"enable_preview_from_file_finder": false,
"enable_preview_from_code_navigation": false,
}
启用从文件查找器预览
- 描述:确定从文件查找器中选择文件时是否以预览模式打开文件。
- 设置:
enable_preview_from_file_finder
- 默认值:
false
选项
boolean
值
启用从代码导航预览
- 描述:确定当使用代码导航从标签页导航离开时,是否替换预览标签页。
- 设置:
enable_preview_from_code_navigation
- 默认值:
false
选项
boolean
值
文件查找器
文件图标
- 描述:是否在文件查找器中显示文件图标。
- 设置:
file_icons
- 默认值:
true
模态框最大宽度
- 描述:文件查找器模态框的最大宽度。 它可以采用以下值之一:
small
、medium
、large
、xlarge
和full
。 - 设置:
modal_max_width
- 默认值:
small
跳过活动文件在搜索中的聚焦
- 描述:确定文件查找器是否应跳过搜索结果中活动文件的聚焦。
- 设置:
skip_focus_for_active_in_search
- 默认值:
true
首选行长度
- 描述:启用软换行的缓冲区中,行的软换行所在的列。
- 设置:
preferred_line_length
- 默认值:
80
选项
integer
值
默认在线项目
- 描述:是否默认显示在线项目视图。
- 设置:
projects_online_by_default
- 默认值:
true
选项
boolean
值
保存时移除尾随空格
- 描述:是否在保存缓冲区之前删除缓冲区行中的任何尾随空格。
- 设置:
remove_trailing_whitespace_on_save
- 默认值:
true
选项
boolean
值
搜索
- 描述:打开新项目和缓冲区搜索时默认启用的搜索选项。
- 设置:
search
- 默认
"search": {
"whole_word": false,
"case_sensitive": false,
"include_ignored": false,
"regex": false
},
从光标处初始化搜索查询
- 描述:何时根据光标下的文本填充新的搜索查询。
- 设置:
seed_search_query_from_cursor
- 默认值:
always
选项
always
始终用光标下的单词填充搜索查询selection
仅在有文本被选中时填充搜索查询never
永远不填充搜索查询
使用智能大小写搜索
- 描述:启用后,根据您的查询自动调整搜索的大小写敏感度。 如果您的搜索查询包含任何大写字母,则搜索将区分大小写; 如果它只包含小写字母,则搜索不区分大小写。
这适用于文件内搜索和项目范围内的搜索。 - 设置:
use_smartcase_search
- 默认值:
false
选项
boolean
值
示例
- 搜索 "function" 将匹配 "function", "Function", "FUNCTION" 等。
- 搜索 "Function" 将仅匹配 "Function",不匹配 "function" 或 "FUNCTION"
显示调用状态图标
- 描述:是否在状态栏中显示调用状态图标。
- 设置:
show_call_status_icon
- 默认值:
true
选项
boolean
值
补全
- 描述:控制如何处理此语言的补全。
- 设置:
completions
- 默认
{
"completions": {
"words": "fallback",
"lsp": true,
"lsp_fetch_timeout_ms": 0,
"lsp_insert_mode": "replace_suffix"
}
}
单词
- 描述:控制如何完成单词。 对于大型文档,可能不会获取所有单词以进行补全。
- 设置:
words
- 默认值:
fallback
选项
enabled
- 始终获取文档的单词以进行补全,以及 LSP 补全fallback
- 仅当 LSP 响应错误或超时时,才使用文档的单词来显示补全disabled
- 永远不获取或补全文档的单词以进行补全(基于单词的补全仍然可以通过单独的操作进行查询)
LSP
- 描述:是否获取 LSP 补全。
- 设置:
lsp
- 默认值:
true
选项
boolean
值
LSP 获取超时 (毫秒)
- 描述:获取 LSP 补全时,确定等待特定服务器响应的时间。 设置为 0 时,无限期等待。
- 设置:
lsp_fetch_timeout_ms
- 默认值:
0
选项
表示毫秒的 integer
值
LSP 插入模式
- 描述:控制接受 LSP 补全时要替换的范围。
- 设置:
lsp_insert_mode
- 默认值:
replace_suffix
选项
insert
- 使用 LSP 规范中描述的insert
范围替换光标前的文本replace
- 使用 LSP 规范中描述的replace
范围替换光标前后的文本replace_subsequence
- 如果要替换的文本是补全文本的子序列,则行为类似于"replace"
,否则类似于"insert"
replace_suffix
- 如果光标后的文本是补全的后缀,则行为类似于"replace"
,否则类似于"insert"
在输入时显示补全
- 描述:是否在您键入时显示补全。
- 设置:
show_completions_on_input
- 默认值:
true
选项
boolean
值
显示补全文档
- 描述:是否显示补全菜单中项目的内联和并排文档。
- 设置:
show_completion_documentation
- 默认值:
true
选项
boolean
值
显示编辑预测
- 描述:是否在您键入时显示编辑预测,或者通过手动触发
editor::ShowEditPrediction
来显示。 - 设置:
show_edit_predictions
- 默认值:
true
选项
boolean
值
显示空格
- 描述:是否在编辑器中呈现空格字符。
- 设置:
show_whitespaces
- 默认值:
selection
选项
全部
选择
无
边界
软换行
- 描述:是否自动换行文本行以适应编辑器/首选宽度。
- 设置:
soft_wrap
- 默认值:
none
选项
none
通常避免换行,除非该行太长prefer_line
(已弃用,与none
相同)editor_width
换行超出编辑器宽度的行preferred_line_length
换行超出preferred_line_length
配置值的行bounded
在editor_width
和preferred_line_length
的最小值处换行
换行引导线(垂直标尺)
- 描述:将垂直标尺显示为换行引导线的位置。 通过将
show_wrap_guides
设置为false
来禁用。 - 设置:
wrap_guides
- 默认值:[]
选项
integer
列号列表
制表符大小
- 描述:每个制表符使用的空格数。
- 设置:
tab_size
- 默认值:
4
选项
integer
值
遥测
- 描述:控制 Zed 收集的信息。
- 设置:
telemetry
- 默认
"telemetry": {
"diagnostics": true,
"metrics": true
},
选项
诊断
- 描述:用于发送与调试相关的数据(例如崩溃报告)的设置。
- 设置:
diagnostics
- 默认值:
true
选项
boolean
值
指标
- 描述:用于发送匿名使用情况数据(例如您使用 Zed 的语言)的设置。
- 设置:
metrics
- 默认值:
true
选项
boolean
值
终端
- 描述:终端的配置。
- 设置:
terminal
- 默认
{
"terminal": {
"alternate_scroll": "off",
"blinking": "terminal_controlled",
"copy_on_select": false,
"dock": "bottom",
"default_width": 640,
"default_height": 320,
"detect_venv": {
"on": {
"directories": [".env", "env", ".venv", "venv"],
"activate_script": "default"
}
},
"env": {},
"font_family": null,
"font_features": null,
"font_size": null,
"line_height": "comfortable",
"option_as_meta": false,
"button": true,
"shell": "system",
"toolbar": {
"breadcrumbs": true
},
"working_directory": "current_project_directory",
"scrollbar": {
"show": null
}
}
}
终端:停靠
- 描述:控制停靠的位置
- 设置:
dock
- 默认值:
bottom
选项
"bottom"
, "left"
或 "right"
终端:交替滚动
- 描述:设置默认情况下是否激活交替滚动模式(DECSET 代码:
?1007
)。 交替滚动模式将鼠标滚动事件转换为在交替屏幕中向上/向下按键(例如,运行 vim 或 less 等应用程序时)。 终端仍然可以使用 ANSI 转义码设置和取消设置此模式。 - 设置:
alternate_scroll
- 默认值:
off
选项
- 默认将交替滚动模式设置为关闭
{
"terminal": {
"alternate_scroll": "off"
}
}
- 默认将交替滚动模式设置为开启
{
"terminal": {
"alternate_scroll": "on"
}
}
终端:闪烁
- 描述:设置终端中光标的闪烁行为
- 设置:
blinking
- 默认值:
terminal_controlled
选项
- 永不闪烁光标,忽略终端模式
{
"terminal": {
"blinking": "off"
}
}
- 默认光标闪烁为关闭,但允许终端开启闪烁
{
"terminal": {
"blinking": "terminal_controlled"
}
}
- 始终闪烁光标,忽略终端模式
{
"terminal": {
"blinking": "on"
}
}
终端:选择时复制
- 描述:在终端中选择文本是否会自动复制到系统剪贴板。
- 设置:
copy_on_select
- 默认值:
false
选项
boolean
值
示例
{
"terminal": {
"copy_on_select": true
}
}
终端:环境变量
- 描述:添加到此对象的任何键值对都将添加到终端的环境变量中。 键必须是唯一的,使用
:
分隔单个变量中的多个值 - 设置:
env
- 默认值:
{}
示例
{
"terminal": {
"env": {
"ZED": "1",
"KEY": "value1:value2"
}
}
}
终端:字体大小
- 描述:终端使用的字体大小。 如果未设置,则默认为匹配编辑器的字体大小
- 设置:
font_size
- 默认值:
null
选项
integer
值
{
"terminal": {
"font_size": 15
}
}
终端:字体系列
- 描述:终端使用的字体。 如果未设置,则默认为匹配编辑器的字体。
- 设置:
font_family
- 默认值:
null
选项
用户系统上安装的任何字体系列的名称
{
"terminal": {
"font_family": "Berkeley Mono"
}
}
终端:字体特性
- 描述:终端使用的字体特性。 如果未设置,则默认为匹配编辑器的字体特性。
- 设置:
font_features
- 默认值:
null
- 平台:macOS 和 Windows。
选项
参见缓冲区字体特性
{
"terminal": {
"font_features": {
"calt": false
// See Buffer Font Features for more features
}
}
}
终端:行高
- 描述:设置终端的行高。
- 设置:
line_height
- 默认值:
comfortable
选项
- 使用
comfortable
的行高进行阅读,1.618。(默认)
{
"terminal": {
"line_height": "comfortable"
}
}
- 使用
standard
行高,1.3。 此选项对于 TUI 很有用,特别是如果它们使用框字符
{
"terminal": {
"line_height": "standard"
}
}
- 使用自定义行高。
{
"terminal": {
"line_height": {
"custom": 2
}
}
}
终端:Option 键作为 Meta 键
- 描述:将 option 键重新解释为类似于 Emacs 中的“meta”键。
- 设置:
option_as_meta
- 默认值:
false
选项
boolean
值
{
"terminal": {
"option_as_meta": true
}
}
终端:Shell
- 描述:启动终端时使用的 shell。
- 设置:
shell
- 默认值:
system
选项
- 使用系统的默认终端配置(通常是
/etc/passwd
文件)。
{
"terminal": {
"shell": "system"
}
}
- 要启动的程序
{
"terminal": {
"shell": {
"program": "sh"
}
}
}
- 带有参数的程序
{
"terminal": {
"shell": {
"with_arguments": {
"program": "/bin/bash",
"args": ["--login"]
}
}
}
}
终端:检测虚拟环境
- 描述:激活 Python 虚拟环境(如果在终端的工作目录中找到),(由 working_directory 解析并自动激活虚拟环境。
- 设置:
detect_venv
- 默认
{
"terminal": {
"detect_venv": {
"on": {
// Default directories to search for virtual environments, relative
// to the current working directory. We recommend overriding this
// in your project's settings, rather than globally.
"directories": [".env", "env", ".venv", "venv"],
// Can also be `csh`, `fish`, and `nushell`
"activate_script": "default"
}
}
}
}
禁用使用
{
"terminal": {
"detect_venv": "off"
}
}
终端:工具栏
- 描述:是否在终端工具栏中显示各种元素。
- 设置:
toolbar
- 默认
{
"terminal": {
"toolbar": {
"breadcrumbs": true
}
}
}
选项
目前,只有 breadcrumbs
选项可用,它控制终端标题的显示,可以通过 PROMPT_COMMAND
进行更改。
如果终端标题为空,则不会显示面包屑。
需要在终端中运行的 shell 配置为发出标题。
设置标题的示例命令:echo -e "\e]2;New Title\007";
终端:按钮
- 描述:控制在状态栏中显示或隐藏终端按钮
- 设置:
button
- 默认值:
true
选项
boolean
值
{
"terminal": {
"button": false
}
}
终端:工作目录
- 描述:启动终端时使用的工作目录。
- 设置:
working_directory
- 默认值:
"current_project_directory"
选项
- 使用当前文件所在项目的目录。 如果不成功,将回退到第一个项目目录策略
{
"terminal": {
"working_directory": "current_project_directory"
}
}
- 使用此工作区目录中的第一个项目。 将回退到使用此平台的 home 目录。
{
"terminal": {
"working_directory": "first_project_directory"
}
}
- 始终使用此平台的 home 目录(如果我们可以找到它)
{
"terminal": {
"working_directory": "always_home"
}
}
- 始终使用特定目录。 此值将进行 shell 扩展。 如果此路径不是有效目录,则终端将默认为此平台的 home 目录。
{
"terminal": {
"working_directory": {
"always": {
"directory": "~/zed/projects/"
}
}
}
}
主题
- 描述:主题设置可以指定为两种形式 - 要么是主题的名称,要么是包含 Zed UI 的
mode
、dark
和light
主题的对象。 - 设置:
theme
- 默认值:
One Dark
主题对象
- 描述:使用包含
mode
、dark
和light
主题的对象来指定主题。 - 设置:
theme
- 默认
"theme": {
"mode": "system",
"dark": "One Dark",
"light": "One Light"
},
模式
- 描述:指定主题模式。
- 设置:
mode
- 默认值:
system
选项
- 将主题设置为深色模式
{
"mode": "dark"
}
- 将主题设置为浅色模式
{
"mode": "light"
}
- 将主题设置为系统模式
{
"mode": "system"
}
深色
- 描述:用于 UI 的深色 Zed 主题的名称。
- 设置:
dark
- 默认值:
One Dark
选项
在命令面板中运行 theme selector: toggle
操作以查看当前有效主题名称的列表。
浅色
- 描述:用于 UI 的浅色 Zed 主题的名称。
- 设置:
light
- 默认值:
One Light
选项
在命令面板中运行 theme selector: toggle
操作以查看当前有效主题名称的列表。
Vim
- 描述:是否启用 vim 模式(正在进行中)。
- 设置:
vim_mode
- 默认值:
false
项目面板
- 描述: 自定义项目面板
- 设置:
project_panel
- 默认
{
"project_panel": {
"button": true,
"default_width": 240,
"dock": "left",
"entry_spacing": "comfortable",
"file_icons": true,
"folder_icons": true,
"git_status": true,
"indent_size": 20,
"auto_reveal_entries": true,
"auto_fold_dirs": true,
"scrollbar": {
"show": null
},
"show_diagnostics": "all",
"indent_guides": {
"show": "always"
}
}
}
停靠
- 描述:控制停靠的位置
- 设置:
dock
- 默认:
left
选项
- 默认停靠位置为左侧
{
"dock": "left"
}
- 默认停靠位置为右侧
{
"dock": "right"
}
条目间距
- 描述: 工作树条目之间的间距
- 设置:
entry_spacing
- 默认值:
comfortable
选项
- 舒适的条目间距
{
"entry_spacing": "comfortable"
}
- 标准的条目间距
{
"entry_spacing": "standard"
}
Git 状态
- 描述: 指示新创建和更新的文件
- 设置:
git_status
- 默认值:
true
选项
- 默认启用 git 状态
{
"git_status": true
}
- 默认禁用 git 状态
{
"git_status": false
}
默认宽度
- 描述: 自定义项目面板占用的默认宽度
- 设置:
default_width
- 默认:
240
选项
float
值
自动显示条目
- 描述: 当相应的项目条目变为活动状态时,是否在项目面板中自动显示它。被 .gitignore 忽略的条目永远不会自动显示。
- 设置:
auto_reveal_entries
- 默认值:
true
选项
- 启用自动显示条目
{
"auto_reveal_entries": true
}
- 禁用自动显示条目
{
"auto_reveal_entries": false
}
自动折叠目录
- 描述: 当目录内只有一个目录时,是否自动折叠目录。
- 设置:
auto_fold_dirs
- 默认值:
true
选项
- 启用自动折叠目录
{
"auto_fold_dirs": true
}
- 禁用自动折叠目录
{
"auto_fold_dirs": false
}
缩进大小
- 描述: 嵌套项的缩进量(以像素为单位)。
- 设置:
indent_size
- 默认:
20
缩进参考线: 显示
- 描述: 是否在项目面板中显示缩进参考线。
- 设置:
indent_guides
- 默认
"indent_guides": {
"show": "always"
}
选项
- 在项目面板中显示缩进参考线
{
"indent_guides": {
"show": "always"
}
}
- 在项目面板中隐藏缩进参考线
{
"indent_guides": {
"show": "never"
}
}
滚动条: 显示
- 描述: 是否在项目面板中显示滚动条。可能的值:null、"auto"、"system"、"always"、"never"。如果缺失,则继承编辑器设置,有关更多详细信息,请参阅其描述。
- 设置:
scrollbar
- 默认
"scrollbar": {
"show": null
}
选项
- 在项目面板中显示滚动条
{
"scrollbar": {
"show": "always"
}
}
- 在项目面板中隐藏滚动条
{
"scrollbar": {
"show": "never"
}
}
助手面板
- 描述: 自定义助手面板
- 设置:
assistant
- 默认
"assistant": {
"version": "2",
"enabled": true,
"button": true,
"dock": "right",
"default_width": 640,
"default_height": 320,
"default_model": {
"provider": "zed.dev",
"model": "claude-3-7-sonnet-latest"
},
"editor_model": {
"provider": "zed.dev",
"model": "claude-3-7-sonnet-latest"
}
}
大纲面板
- 描述: 自定义大纲面板
- 设置:
outline_panel
- 默认
"outline_panel": {
"button": true,
"default_width": 300,
"dock": "left",
"file_icons": true,
"folder_icons": true,
"git_status": true,
"indent_size": 20,
"auto_reveal_entries": true,
"auto_fold_dirs": true,
"indent_guides": {
"show": "always"
},
"scrollbar": {
"show": null
}
}
通话
- 描述: 自定义参与通话时的行为
- 设置:
calls
- 默认
"calls": {
// Join calls with the microphone live by default
"mute_on_join": false,
// Share your project when you are the first to join a channel
"share_on_join": false
},
不必要的代码淡化
- 描述: 未使用的代码淡化程度。
- 设置:
unnecessary_code_fade
- 默认:
0.3
选项
介于 0.0
和 0.9
之间的浮点值,其中
0.0
表示不淡化(未使用的代码看起来与已使用的代码相同)0.9
表示最大程度的淡化(未使用的代码非常微弱但仍然可见)
示例
{
"unnecessary_code_fade": 0.5
}
UI 字体系列
- 描述: 用于 UI 中文本的字体名称。
- 设置:
ui_font_family
- 默认:
Zed Plex Sans
选项
系统上安装的任何字体系列的名称。
UI 字体特性
- 描述: 为 UI 中的文本启用的 OpenType 特性。
- 设置:
ui_font_features
- 默认
"ui_font_features": {
"calt": false
}
- 平台:macOS 和 Windows。
选项
Zed 支持所有可以为给定 UI 字体启用或禁用的 OpenType 特性,以及设置字体特性的值。
例如,要禁用字体连字,请将以下内容添加到您的设置中
{
"ui_font_features": {
"calt": false
}
}
您还可以设置其他 OpenType 功能,例如将 cv01
设置为 7
{
"ui_font_features": {
"cv01": 7
}
}
UI 字体回退
- 描述: 用于 UI 中文本的字体回退。
- 设置:
ui_font_fallbacks
- 默认值:
null
- 平台:macOS 和 Windows。
选项
例如,要使用 Nerd Font
作为后备,请将以下内容添加到您的设置中
{
"ui_font_fallbacks": ["Nerd Font"]
}
UI 字体大小
- 描述: UI 中文本的默认字体大小。
- 设置:
ui_font_size
- 默认:
16
选项
从 6
到 100
像素(包括)的 integer
值
UI 字体粗细
- 描述: UI 中文本的默认字体粗细。
- 设置:
ui_font_weight
- 默认值:
400
选项
介于 100
和 900
之间的 integer
值
一个配置示例
// ~/.config/zed/settings.json
{
"theme": "cave-light",
"tab_size": 2,
"preferred_line_length": 80,
"soft_wrap": "none",
"buffer_font_size": 18,
"buffer_font_family": "Zed Plex Mono",
"autosave": "on_focus_change",
"format_on_save": "off",
"vim_mode": false,
"projects_online_by_default": true,
"terminal": {
"font_family": "FiraCode Nerd Font Mono",
"blinking": "off"
},
"languages": {
"C": {
"format_on_save": "language_server",
"preferred_line_length": 64,
"soft_wrap": "preferred_line_length"
}
}
}