diff options
-rw-r--r-- | docs/Config.md | 2 | ||||
-rw-r--r-- | pkg/config/editor_presets.go | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/docs/Config.md b/docs/Config.md index bc860156c..8fafbb2a2 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -289,7 +289,7 @@ os: ``` Supported presets are `vim`, `nvim`, `emacs`, `nano`, `vscode`, `sublime`, `bbedit`, -`kakoune` and `xcode`. In many cases lazygit will be able to guess the right preset +`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. If for some reason you are not happy with the default commands from a preset, or diff --git a/pkg/config/editor_presets.go b/pkg/config/editor_presets.go index 76b9d5996..38e41ec49 100644 --- a/pkg/config/editor_presets.go +++ b/pkg/config/editor_presets.go @@ -44,6 +44,7 @@ func getPreset(osConfig *OSConfig, guessDefaultEditor func() string) *editPreset "emacs": standardTerminalEditorPreset("emacs"), "nano": standardTerminalEditorPreset("nano"), "kakoune": standardTerminalEditorPreset("kakoune"), + "hx": helixEditorPreset(), "vscode": { editTemplate: "code --reuse-window -- {{filename}}", editAtLineTemplate: "code --reuse-window --goto -- {{filename}}:{{line}}", @@ -104,6 +105,15 @@ func standardTerminalEditorPreset(editor string) *editPreset { } } +func helixEditorPreset() *editPreset { + return &editPreset{ + editTemplate: "hx -- {{filename}}", + editAtLineTemplate: "hx -- {{filename}}:{{line}}", + editAtLineAndWaitTemplate: "hx -- {{filename}}:{{line}}", + editInTerminal: true, + } +} + func getEditInTerminal(osConfig *OSConfig, preset *editPreset) bool { if osConfig.EditInTerminal != nil { return *osConfig.EditInTerminal |