Skip to content

配置模板

基础配置

适合大多数开发者的起点配置:

json
{
  "theme": {
    "mode": "system",
    "light": "One Light",
    "dark": "One Dark"
  },
  "ui_font_family": ".SystemUIFont",
  "ui_font_size": 16,
  "buffer_font_family": "Cascadia Code",
  "buffer_font_size": 14,
  "buffer_font_features": {
    "calt": true,
    "liga": true
  },
  "tab_size": 2,
  "hard_tabs": false,
  "format_on_save": "on",
  "autosave": {
    "after_delay": {
      "milliseconds": 1000
    }
  },
  "cursor_shape": "bar",
  "cursor_blink": false,
  "show_whitespaces": "selection",
  "line_ending": "\n",
  "git": {
    "git_gutter": "tracked_files",
    "inline_blame": {
      "enabled": true,
      "delay_ms": 500
    }
  },
  "git_panel": {
    "dock": "right",
    "tree_view": true
  },
  "terminal": {
    "shell": "system",
    "working_directory": "current_project_directory"
  },
  "project_panel": {
    "dock": "left",
    "default_width": 240
  },
  "minimap": {
    "show": "auto"
  },
  "diagnostics": {
    "inline": {
      "enabled": true
    }
  }
}

前端开发配置

针对 JavaScript/TypeScript/React 开发:

json
{
  "languages": {
    "JavaScript": {
      "tab_size": 2,
      "format_on_save": "on"
    },
    "TypeScript": {
      "tab_size": 2,
      "format_on_save": "on"
    },
    "TSX": {
      "tab_size": 2,
      "format_on_save": "on"
    },
    "CSS": {
      "tab_size": 2
    },
    "HTML": {
      "tab_size": 2
    },
    "JSON": {
      "tab_size": 2
    }
  }
}

Python 开发配置

json
{
  "languages": {
    "Python": {
      "tab_size": 4,
      "hard_tabs": false,
      "format_on_save": "on",
      "formatter": {
        "external": {
          "command": "black",
          "arguments": ["-"]
        }
      }
    }
  }
}

完整配置(整合版)

json
{
  "theme": {
    "mode": "system",
    "light": "One Light",
    "dark": "One Dark"
  },
  "ui_font_family": ".SystemUIFont",
  "ui_font_size": 16,
  "buffer_font_family": "Cascadia Code",
  "buffer_font_size": 14,
  "buffer_font_features": {
    "calt": true,
    "liga": true
  },
  "tab_size": 2,
  "hard_tabs": false,
  "format_on_save": "on",
  "autosave": {
    "after_delay": {
      "milliseconds": 1000
    }
  },
  "cursor_shape": "bar",
  "cursor_blink": false,
  "show_whitespaces": "selection",
  "line_ending": "\n",
  "git": {
    "git_gutter": "tracked_files",
    "inline_blame": {
      "enabled": true,
      "delay_ms": 500
    }
  },
  "git_panel": {
    "dock": "right",
    "tree_view": true
  },
  "terminal": {
    "shell": "system",
    "working_directory": "current_project_directory"
  },
  "project_panel": {
    "dock": "left",
    "default_width": 240
  },
  "languages": {
    "JavaScript": {
      "tab_size": 2,
      "format_on_save": "on"
    },
    "TypeScript": {
      "tab_size": 2,
      "format_on_save": "on"
    },
    "TSX": {
      "tab_size": 2,
      "format_on_save": "on"
    },
    "Python": {
      "tab_size": 4,
      "format_on_save": "on",
      "formatter": {
        "external": {
          "command": "black",
          "arguments": ["-"]
        }
      }
    },
    "CSS": {
      "tab_size": 2
    },
    "HTML": {
      "tab_size": 2
    },
    "JSON": {
      "tab_size": 2
    },
    "Markdown": {
      "soft_wrap": "editor_width"
    }
  }
}

复制以上内容到 settings.json 即可使用。根据需要自行调整。

基于 Zed 官方文档及社区资料整理,仅供学习参考