summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-03-02 10:16:58 +0100
committerGitHub <noreply@github.com>2024-03-02 10:16:58 +0100
commited34ddc04d24e28603ddf8c7166ffc11db080f01 (patch)
treef629247e02e5c78d0523d44592db4393233a2a55
parent69c94777835dabfacf336902e396959d6b259b59 (diff)
parent581161ac342b58e75ed851259cab0c57b7b0e2c5 (diff)
Provide two helix presets, one for "helix" and one for "hx" (#3346)
The helix binary seems to be called "helix" on some distributions (e.g. Arch), but "hx" on others (e.g. Fedora). Provide presets for both, so that auto-detection from $EDITOR works. See https://github.com/jesseduffield/lazygit/issues/2624#issuecomment-1966509979.
-rw-r--r--pkg/config/editor_presets.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/pkg/config/editor_presets.go b/pkg/config/editor_presets.go
index 284b21306..a718e6e17 100644
--- a/pkg/config/editor_presets.go
+++ b/pkg/config/editor_presets.go
@@ -65,6 +65,13 @@ func getPreset(osConfig *OSConfig, guessDefaultEditor func() string) *editPreset
"nano": standardTerminalEditorPreset("nano"),
"kakoune": standardTerminalEditorPreset("kak"),
"helix": {
+ editTemplate: "helix -- {{filename}}",
+ editAtLineTemplate: "helix -- {{filename}}:{{line}}",
+ editAtLineAndWaitTemplate: "helix -- {{filename}}:{{line}}",
+ openDirInEditorTemplate: "helix -- {{dir}}",
+ suspend: true,
+ },
+ "helix (hx)": {
editTemplate: "hx -- {{filename}}",
editAtLineTemplate: "hx -- {{filename}}:{{line}}",
editAtLineAndWaitTemplate: "hx -- {{filename}}:{{line}}",
@@ -103,11 +110,12 @@ func getPreset(osConfig *OSConfig, guessDefaultEditor func() string) *editPreset
// Some of our presets have a different name than the editor they are using.
editorToPreset := map[string]string{
- "kak": "kakoune",
- "hx": "helix",
- "code": "vscode",
- "subl": "sublime",
- "xed": "xcode",
+ "kak": "kakoune",
+ "helix": "helix",
+ "hx": "helix (hx)",
+ "code": "vscode",
+ "subl": "sublime",
+ "xed": "xcode",
}
presetName := osConfig.EditPreset