summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvic <info@dvic.io>2023-05-24 22:59:04 +0200
committerdvic <info@dvic.io>2023-05-24 23:08:26 +0200
commited496deecacd04eda9f34843c505bf8baeb91ed7 (patch)
tree7430913d7a9cc422ac79d33072b6a676d1f0db51
parent1f8e838052a1bc083cb50560431b2f115df8acb6 (diff)
Add helix editor preset
-rw-r--r--docs/Config.md2
-rw-r--r--pkg/config/editor_presets.go10
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