From f0eafabd6dfdccad00cf122b45fa73c89458c3ab Mon Sep 17 00:00:00 2001 From: Dmytro Suvorov <992467+susl@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:30:56 +0300 Subject: [PATCH 1/3] Add Zed support to editor_presets.go --- pkg/config/editor_presets.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/config/editor_presets.go b/pkg/config/editor_presets.go index ca784c135..3a14c886f 100644 --- a/pkg/config/editor_presets.go +++ b/pkg/config/editor_presets.go @@ -113,6 +113,13 @@ func getPreset(osConfig *OSConfig, guessDefaultEditor func() string) *editPreset openDirInEditorTemplate: "xed -- {{dir}}", suspend: returnBool(false), }, + "zed": { + editTemplate: "zed -- {{filename}}", + editAtLineTemplate: "zed -- {{filename}}:{{line}}", + editAtLineAndWaitTemplate: "zed --wait -- {{filename}}:{{line}}", + openDirInEditorTemplate: "zed -- {{dir}}", + suspend: returnBool(false), + }, } // Some of our presets have a different name than the editor they are using. From c35743d7ad48611d670a14fe844515f57bec2847 Mon Sep 17 00:00:00 2001 From: Dmytro Suvorov <992467+susl@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:40:06 +0300 Subject: [PATCH 2/3] Add Zed to docs/Config.md --- docs/Config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Config.md b/docs/Config.md index b4c4a92d6..c81d1dc01 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -673,7 +673,7 @@ os: editPreset: 'vscode' ``` -Supported presets are `vim`, `nvim`, `nvim-remote`, `lvim`, `emacs`, `nano`, `micro`, `vscode`, `sublime`, `bbedit`, `kakoune`, `helix`, and `xcode`. In many cases lazygit will be able to guess the right preset from your $(git config core.editor), or an environment variable such as $VISUAL or $EDITOR. +Supported presets are `vim`, `nvim`, `nvim-remote`, `lvim`, `emacs`, `nano`, `micro`, `vscode`, `sublime`, `bbedit`, `kakoune`, `helix`, `xcode`, and `zed`. In many cases lazygit will be able to guess the right preset from your $(git config core.editor), or an environment variable such as $VISUAL or $EDITOR. `nvim-remote` is an experimental preset for when you have invoked lazygit from within a neovim process, allowing lazygit to open the file from within the parent process rather than spawning a new one. From da7a28c1175e74a5ee73fd272632da9c56f9448b Mon Sep 17 00:00:00 2001 From: Dmytro Suvorov <992467+susl@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:48:37 +0300 Subject: [PATCH 3/3] Add Zed to user_config.go and schema --- pkg/config/user_config.go | 2 +- schema/config.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 01c546048..e11e5b6c2 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -546,7 +546,7 @@ type OSConfig struct { // A built-in preset that sets all of the above settings. Supported presets // are defined in the getPreset function in editor_presets.go. - EditPreset string `yaml:"editPreset,omitempty" jsonschema:"example=vim,example=nvim,example=emacs,example=nano,example=vscode,example=sublime,example=kakoune,example=helix,example=xcode"` + EditPreset string `yaml:"editPreset,omitempty" jsonschema:"example=vim,example=nvim,example=emacs,example=nano,example=vscode,example=sublime,example=kakoune,example=helix,example=xcode,example=zed"` // Command for opening a file, as if the file is double-clicked. Should // contain "{{filename}}", but doesn't support "{{line}}". diff --git a/schema/config.json b/schema/config.json index f1aa4544b..dc5db6f58 100644 --- a/schema/config.json +++ b/schema/config.json @@ -788,7 +788,8 @@ "sublime", "kakoune", "helix", - "xcode" + "xcode", + "zed" ] }, "open": {