Skip to content

Commit

Permalink
Add helix editor preset
Browse files Browse the repository at this point in the history
  • Loading branch information
dvic committed May 24, 2023
1 parent 1f8e838 commit ed496de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions pkg/config/editor_presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}}",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ed496de

Please sign in to comment.