尧图网站设计 尧图网站设计YAOTU DESIGN
ARTICLE DETAIL

资讯详情

深耕网站设计与一线实操的经验洞察。

如何从 VS Code 迁移到 Zed:设置导入与键位差异对照

如何从 VS Code 迁移到 Zed:设置导入与键位差异对照 如何从 VS Code 迁移到 Zed设置导入与键位差异对照【免费下载链接】zedCode at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.项目地址: https://gitcode.com/GitHub_Trending/ze/zed如果你正在用 VS Code 开发想换到 Zed 但不想从零重建自己的工作流这篇基于 Zed 官方文档VS Code 迁移指南的文章给出完整操作路径先安装 Zed再通过官方导入功能把 VS Code 的核心设置搬过来然后用 Zed 的 VS Code 基础键位 键位编辑器补齐快捷键最后对照文档给出的差异表调整 UI 使用习惯。Zed 支持 macOS、Windows 和 Linux以下命令和按键均按文档原文保留Cmd对应 macOS 的 Command 键Linux/Windows 上多数场景对应Ctrl。安装并启动 Zed迁移的第一步是装好 Zed 并确认能打开项目macOS从 zed.dev/download 下载安装包或用 Homebrewbrew install --cask zedLinux文档给出的最简方式下面这条命令会下载并执行 Zed 官方安装脚本会修改系统安装 Zed 及相关依赖执行前确认你的发行版在 Zed 支持范围内curl -f https://zed.dev/install.sh | sh安装完成后启动 ZedmacOS 从应用程序文件夹启动Linux 也可以在终端直接启动。在任意项目目录下运行zed .会用 Zed 打开当前目录用来验证安装成功。导入 VS Code 设置Zed 在 onboarding首次设置向导中提供 “Import Settings from VS Code” 选项用于把 VS Code 的关键设置批量导入。如果你在向导中跳过了这一步之后可以随时补做打开命令调色板CmdShiftPLinux/Windows 为CtrlShiftP执行zed::ImportVsCodeSettings在调色板中搜索 “Import Settings from VS Code”。文档明确说明扩展和键位不会被导入导入只覆盖核心编辑器行为。以下是文档列出的自动导入映射来源vs-code.md。EditorVS Code SettingZed Settingeditor.fontFamilybuffer_font_familyeditor.fontSizebuffer_font_sizeeditor.fontWeightbuffer_font_weighteditor.tabSizetab_sizeeditor.insertSpaceshard_tabs语义取反editor.wordWrapsoft_wrapeditor.wordWrapColumnpreferred_line_lengtheditor.cursorStylecursor_shapeeditor.cursorBlinkingcursor_blinkeditor.renderLineHighlightcurrent_line_highlighteditor.lineNumbersgutter.line_numbers,relative_line_numberseditor.showFoldingControlsgutter.foldseditor.minimap.enabledminimap.showeditor.minimap.autohideminimap.showeditor.minimap.showSliderminimap.thumbeditor.minimap.maxColumnminimap.max_width_columnseditor.stickyScroll.enabledsticky_scroll.enablededitor.scrollbar.horizontalscrollbar.axes.horizontaleditor.scrollbar.verticalscrollbar.axes.verticaleditor.mouseWheelScrollSensitivityscroll_sensitivityeditor.fastScrollSensitivityfast_scroll_sensitivityeditor.cursorSurroundingLinesvertical_scroll_margineditor.hover.enabledhover_popover_enablededitor.hover.delayhover_popover_delayeditor.hover.stickyhover_popover_stickyeditor.hover.hidingDelayhover_popover_hiding_delayeditor.parameterHints.enabledauto_signature_helpworkbench.editor.languageDetectionlanguage_detectioneditor.multiCursorModifiermulti_cursor_modifiereditor.selectionHighlightselection_highlighteditor.roundedSelectionrounded_selectioneditor.find.seedSearchStringFromSelectionseed_search_query_from_cursoreditor.rulerswrap_guideseditor.renderWhitespaceshow_whitespaceseditor.guides.indentationindent_guides.enablededitor.linkedEditinglinked_editseditor.autoSurrounduse_auto_surroundeditor.formatOnSaveformat_on_saveeditor.formatOnPasteauto_indent_on_pasteeditor.formatOnTypeuse_on_type_formateditor.trimAutoWhitespaceremove_trailing_whitespace_on_saveeditor.suggestOnTriggerCharactersshow_completions_on_inputeditor.suggest.showWordscompletions.wordseditor.inlineSuggest.enabledshow_edit_predictionsFiles WorkspaceVS Code SettingZed Settingfiles.autoSaveautosavefiles.autoSaveDelayautosave.millisecondsfiles.insertFinalNewlineensure_final_newline_on_savefiles.associationsfile_typesfiles.watcherExcludefile_scan_exclusionsfiles.watcherIncludefile_scan_inclusionsfiles.simpleDialog.enableuse_system_path_promptssearch.smartCaseuse_smartcase_searchsearch.useIgnoreFilessearch.include_ignoredTerminalVS Code SettingZed Settingterminal.integrated.fontFamilyterminal.font_familyterminal.integrated.fontSizeterminal.font_sizeterminal.integrated.lineHeightterminal.line_heightterminal.integrated.cursorStyleterminal.cursor_shapeterminal.integrated.cursorBlinkingterminal.blinkingterminal.integrated.copyOnSelectionterminal.copy_on_selectterminal.integrated.scrollbackterminal.max_scroll_history_linesterminal.integrated.macOptionIsMetaterminal.option_as_metaterminal.integrated.{platform}Execterminal.shellterminal.integrated.env.{platform}terminal.envTabs PanelsVS Code SettingZed Settingworkbench.editor.showTabstab_bar.showworkbench.editor.showIconstabs.file_iconsworkbench.editor.tabActionLocationtabs.close_positionworkbench.editor.tabActionCloseVisibilitytabs.show_close_buttonworkbench.editor.focusRecentEditorAfterClosetabs.activate_on_closeworkbench.editor.enablePreviewpreview_tabs.enabledworkbench.editor.enablePreviewFromQuickOpenpreview_tabs.enable_preview_from_file_finderworkbench.editor.enablePreviewFromCodeNavigationpreview_tabs.enable_preview_from_code_navigationworkbench.editor.editorActionsLocationtab_bar.show_tab_bar_buttonsworkbench.editor.limit.enabled/valuemax_tabsworkbench.editor.restoreViewStaterestore_on_file_reopenworkbench.statusBar.visiblestatus_bar.showProject Panel (File Explorer)VS Code SettingZed Settingexplorer.compactFoldersproject_panel.auto_fold_dirsexplorer.autoRevealproject_panel.auto_reveal_entriesexplorer.excludeGitIgnoreproject_panel.hide_gitignoreproblems.decorations.enabledproject_panel.show_diagnosticsexplorer.decorations.badgesproject_panel.git_statusGitVS Code SettingZed Settinggit.enabledgit_panel.buttongit.defaultBranchNamegit_panel.fallback_branch_namegit.decorations.enabledgit.inline_blame,project_panel.git_statusgit.blame.editorDecoration.enabledgit.inline_blame.enabledWindow BehaviorVS Code SettingZed Settingwindow.confirmBeforeCloseconfirm_quitwindow.nativeTabsuse_system_window_tabswindow.closeWhenEmptywhen_closing_with_no_tabsaccessibility.dimUnfocused.enabled/opacityactive_pane_modifiers.inactive_opacityOtherVS Code SettingZed Settinghttp.proxyproxynpm.packageManagernode.npm_pathtelemetry.telemetryLeveltelemetry.metrics,telemetry.diagnosticsoutline.iconsoutline_panel.file_icons,outline_panel.folder_indicatorchat.agent.enabledagent.enabledmcpcontext_servers文档对几个高频项还给了额外说明来源vs-code.mdZed 默认字体是 Zed Mono所以buffer_font_family需要显式设置才会覆盖buffer_font_size以像素为单位tab_size支持按语言覆盖soft_wrap支持可选的换行列。导入完成后可以打开设置文件逐项核对命令调色板执行zed::OpenSettingsFile文件位于 macOS/Linux 的~/.config/zed/settings.json、Windows 的%APPDATA%\Zed\settings.json对照上表确认tab_size、soft_wrap、format_on_save等对应项的值符合预期。个别语言设置项有导入注意事项例如 Lua 文档指出从 VS Code 导入 Lua 语言服务器选项时要去掉Lua.前缀写runtime.version而不是Lua.runtime.version。键位对照哪些相同、哪些不同如果你在 onboarding 时选择了 VS Code keymap大部分快捷键应该已经是熟悉的。下表来自官方迁移文档。与 VS Code 相同的键位ActionShortcutFind filesCmd PRun a commandCmd Shift PSearch text (project-wide)Cmd Shift FFind symbols (project-wide)Cmd TFind symbols (file-wide)Cmd Shift OToggle left dockCmd BToggle bottom dockCmd JOpen terminalCtrl ~Open file tree explorerCmd Shift EClose current bufferCmd WClose whole projectCmd Shift WRefactor: rename symbolF2Change themeCmd K, Cmd TWrap textOpt ZNavigate open tabsCmd Opt ArrowSyntactic fold / unfoldCmd Opt {或}与 VS Code 不同的键位ActionVS CodeZedOpen recent projectCtrl RCmd Opt OMove lines up/downOpt Up/DownCmd Ctrl Up/DownSplit panesCmd \Cmd K, Arrow KeysExpand SelectionShift Alt RightOpt UpZed 独有的键位ActionShortcut说明Toggle right dockCmd R或Cmd Alt BSyntactic selectionOpt Up/Down按代码结构选区例如大括号内一层层扩选切换与自定义键位Zed 支持多套基础键位VS Code、Atom、JetBrains、Emacs、Sublime Text、TextMate、Cursor、None 等。切换方式来源key-bindings.md在设置窗口Cmd,/Ctrl,中修改base_keymap或在settings.json中直接写取值以设置参考文档为准{ base_keymap: VSCode }或通过命令调色板执行zed::ToggleBaseKeymapSelector。需要个别键位与 VS Code 保持一致时打开键位编辑器命令调色板CmdShiftP执行zed::OpenKeymap。在列表中可以用Change Keybinding/Add Keybinding按钮改绑或新增编辑器中的任何修改都会同步写入keymap.jsonmacOS/Linux~/.config/zed/keymap.jsonWindows~\AppData\Roaming\Zed\keymap.json。文档给出了几个常用的自定义手段用null禁用某个绑定[ { context: Workspace, bindings: { cmd-r: null // cmd-r 在 Workspace 上下文下不做任何事 } } ]用workspace::SendKeystrokes把一个按键映射成一串按键序列单次模拟按键上限 100 个且异步操作要等所有按键分发完才执行。支持像 VS Code 那样的键位和弦多键序列如CmdK CmdC。绑定支持context条件表达式多个绑定冲突时上下文树中更下层的绑定优先同层时后定义的覆盖先定义的用户键位晚于系统键位加载因此用户绑定可以覆盖内置绑定。自定义键位出问题例如布局特殊导致按键不生效时用命令调色板执行dev::OpenKeyContextView查看当前激活的上下文来排查。理解 UI 与项目模型的差异迁移后最容易不适应的是窗口与项目组织方式迁移文档给出了明确对照没有.code-workspace文件在 Zed 中打开一个文件夹就是项目上下文不存在 workspace 文件格式。一个窗口多个项目多个文件夹可以在同一窗口打开各自出现在左侧 threads sidebar 中切换时保留布局和 agent 线程。等价于 VS Code 多根工作区需要在同一项目中放多个文件夹时用菜单 File Add Folder to Project 添加另一个根目录。项目级设置是可选的在项目里创建.zed/settings.json覆盖全局设置项目设置只对编辑器行为和语言工具选项生效theme、vim_mode这类全局设置只能在用户设置中修改。可以不打开文件夹从单个文件或空窗口开始编辑都是合法的。导航习惯上Zed 把命令调色板CmdShiftP和文件查找器CmdP可搜文件、符号和命令作为主要导航手段Project Panel 提供文件树和 Git 状态CmdB可折叠它。日常打开/进入项目的操作# 在终端的项目目录中启动 Zed zed .或在 Zed 内按CmdOLinux 为CtrlO打开文件夹进入项目后用CmdP快速跳转文件。扩展方面Zed 的扩展目录比 VS Code 小没有每个扩展的一一对应替换文档明确提到 DevOps、容器、测试运行器类工具尤其如此但很多 VS Code 里靠扩展实现的能力在 Zed 是内置的实时协作含语音和光标共享、AI 辅助、内置终端面板、全项目模糊搜索、JSON 配置的 Task runner、经 LSP 的内联诊断与代码操作。如果你依赖 GitHub CopilotZed 文档给出的路径是Cmd,打开设置 →AI → Edit Predictions→ 在 “Configure Providers” 旁点Configure→ 在GitHub Copilot下点Sign in to GitHub之后输入时即可获得内联建议。项目里的 .vscode 产物哪些能直接复用除了用户级设置导入仓库内的部分 VS Code 配置文件也能被 Zed 直接使用来源debugger.md、tasks.md调试配置如果项目没有.zed/debug.jsonZed 会读取.vscode/launch.json并把其中的配置显示在新的调试进程对话框中.zed/debug.json存在时以它为准。任务从.vscode/tasks.json导入 VS Code 任务时可以省略label字段Zed 会按任务类型自动生成标签npm 任务为npm: script如npm: startgulp 任务为gulp: taskshell 任务直接用command字符串无 type 的任务显示为Untitled Task。代码片段迁移文档建议把 VS Code 的 snippet JSON 直接复制到 Zed 的 snippets 目录命令调色板执行snippets::ConfigureSnippets打开。边界与不支持项设置导入不覆盖扩展和键位这两类需要分别处理扩展要在 Zed 中按语言/主题重新安装键位用本文的base_keymap 键位编辑器方案。Zed 不提供.code-workspace等价物多根工作区需求用 Add Folder to Project 实现。导入映射表中未列出的 VS Code 设置不会迁移需要在 Zed 设置中手动重新配置Zed 侧设置含义以 all-settings.md 为准。键位表基于 macOS 按键习惯书写Linux/Windows 上平台修饰键对应Ctrl/Super具体以键位编辑器中显示的实际绑定为准。完成以上步骤后的落点是核心编辑器行为字体、缩进、换行、自动保存、终端、Git 装饰等已按你的 VS Code 配置导入并可逐项核对日常快捷键与 VS Code 基本一致且差异项有明确对照项目内.vscode/launch.json与.vscode/tasks.json可继续复用。后续如需更细的行为对照可直接查阅仓库内的 VS Code 迁移指南 与 键位文档。【免费下载链接】zedCode at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.项目地址: https://gitcode.com/GitHub_Trending/ze/zed创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表