1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-07 13:42:01 +02:00

more explicit

This commit is contained in:
Jesse Duffield 2022-03-16 19:46:02 +11:00
parent 866f4b9f0e
commit 11acac0091
4 changed files with 11 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"strconv"
"github.com/go-errors/errors"
"github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@ -58,7 +59,7 @@ func (self *FileCommands) GetEditCmdStr(filename string, lineNumber int) (string
}
editCmdTemplate := self.UserConfig.OS.EditCommandTemplate
if editCmdTemplate == "{{editor}} {{filename}}" {
if editCmdTemplate == config.DefaultEditCommandTemplate {
switch editor {
case "emacs", "nano", "vi", "vim":
editCmdTemplate = "{{editor}} +{{line}} {{filename}}"

View File

@ -3,11 +3,13 @@
package config
const DefaultEditCommandTemplate = `{{editor}} {{filename}}`
// GetPlatformDefaultConfig gets the defaults for the platform
func GetPlatformDefaultConfig() OSConfig {
return OSConfig{
EditCommand: ``,
EditCommandTemplate: `{{editor}} {{filename}}`,
EditCommandTemplate: DefaultEditCommandTemplate,
OpenCommand: "open {{filename}}",
OpenLinkCommand: "open {{link}}",
}

View File

@ -1,10 +1,12 @@
package config
const DefaultEditCommandTemplate = `{{editor}} {{filename}}`
// GetPlatformDefaultConfig gets the defaults for the platform
func GetPlatformDefaultConfig() OSConfig {
return OSConfig{
EditCommand: ``,
EditCommandTemplate: `{{editor}} {{filename}}`,
EditCommandTemplate: DefaultEditCommandTemplate,
OpenCommand: `xdg-open {{filename}} >/dev/null`,
OpenLinkCommand: `xdg-open {{link}} >/dev/null`,
}

View File

@ -1,10 +1,12 @@
package config
const DefaultEditCommandTemplate = `{{editor}} {{filename}}`
// GetPlatformDefaultConfig gets the defaults for the platform
func GetPlatformDefaultConfig() OSConfig {
return OSConfig{
EditCommand: ``,
EditCommandTemplate: `{{editor}} {{filename}}`,
EditCommandTemplate: DefaultEditCommandTemplate,
OpenCommand: `start "" {{filename}}`,
OpenLinkCommand: `start "" {{link}}`,
}