mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-31 03:11:14 +02:00
allow opening merge tool
This commit is contained in:
parent
2d8f7d2a7b
commit
9f4433d8b5
@ -23,6 +23,14 @@ func (c *GitCommand) CatFile(fileName string) (string, error) {
|
||||
return c.OSCommand.CatFile(fileName)
|
||||
}
|
||||
|
||||
func (c *GitCommand) OpenMergeToolCmd() string {
|
||||
return "git mergetool"
|
||||
}
|
||||
|
||||
func (c *GitCommand) OpenMergeTool() error {
|
||||
return c.OSCommand.RunCommand("git mergetool")
|
||||
}
|
||||
|
||||
// StageFile stages a file
|
||||
func (c *GitCommand) StageFile(fileName string) error {
|
||||
return c.RunCommand("git add -- %s", c.OSCommand.Quote(fileName))
|
||||
|
@ -177,6 +177,7 @@ type KeybindingFilesConfig struct {
|
||||
ViewResetOptions string `yaml:"viewResetOptions"`
|
||||
Fetch string `yaml:"fetch"`
|
||||
ToggleTreeView string `yaml:"toggleTreeView"`
|
||||
OpenMergeTool string `yaml:"openMergeTool"`
|
||||
}
|
||||
|
||||
type KeybindingBranchesConfig struct {
|
||||
@ -401,6 +402,7 @@ func GetDefaultConfig() *UserConfig {
|
||||
ViewResetOptions: "D",
|
||||
Fetch: "f",
|
||||
ToggleTreeView: "`",
|
||||
OpenMergeTool: "M",
|
||||
},
|
||||
Branches: KeybindingBranchesConfig{
|
||||
CopyPullRequestURL: "<c-y>",
|
||||
|
@ -879,3 +879,15 @@ func (gui *Gui) handleToggleFileTreeView() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gui *Gui) handleOpenMergeTool() error {
|
||||
return gui.ask(askOpts{
|
||||
title: gui.Tr.MergeToolTitle,
|
||||
prompt: gui.Tr.MergeToolPrompt,
|
||||
handleConfirm: func() error {
|
||||
return gui.runSubprocessWithSuspenseAndRefresh(
|
||||
gui.OSCommand.ExecutableFromString(gui.GitCommand.OpenMergeToolCmd()),
|
||||
)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -514,6 +514,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||
Handler: gui.handleToggleFileTreeView,
|
||||
Description: gui.Tr.LcToggleTreeView,
|
||||
},
|
||||
{
|
||||
ViewName: "files",
|
||||
Contexts: []string{string(FILES_CONTEXT_KEY)},
|
||||
Key: gui.getKey(config.Files.OpenMergeTool),
|
||||
Handler: gui.handleOpenMergeTool,
|
||||
Description: gui.Tr.LcOpenMergeTool,
|
||||
},
|
||||
{
|
||||
ViewName: "branches",
|
||||
Contexts: []string{string(LOCAL_BRANCHES_CONTEXT_KEY)},
|
||||
@ -1408,6 +1415,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||
Handler: gui.handleEscapeMerge,
|
||||
Description: gui.Tr.ReturnToFilesPanel,
|
||||
},
|
||||
{
|
||||
ViewName: "main",
|
||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
||||
Key: gui.getKey(config.Files.OpenMergeTool),
|
||||
Handler: gui.handleOpenMergeTool,
|
||||
Description: gui.Tr.LcOpenMergeTool,
|
||||
},
|
||||
{
|
||||
ViewName: "main",
|
||||
Contexts: []string{string(MAIN_MERGING_CONTEXT_KEY)},
|
||||
|
@ -48,6 +48,7 @@ type TranslationSet struct {
|
||||
LcToggleStaged string
|
||||
LcToggleStagedAll string
|
||||
LcToggleTreeView string
|
||||
LcOpenMergeTool string
|
||||
LcRefresh string
|
||||
LcPush string
|
||||
LcPull string
|
||||
@ -156,6 +157,8 @@ type TranslationSet struct {
|
||||
CouldNotFindBinaryErr string
|
||||
AnonymousReportingTitle string
|
||||
AnonymousReportingPrompt string
|
||||
MergeToolTitle string
|
||||
MergeToolPrompt string
|
||||
IntroPopupMessage string
|
||||
GitconfigParseErr string
|
||||
LcEditFile string
|
||||
@ -683,6 +686,7 @@ func englishTranslationSet() TranslationSet {
|
||||
LcToggleStaged: "toggle staged",
|
||||
LcToggleStagedAll: "stage/unstage all",
|
||||
LcToggleTreeView: "toggle file tree view",
|
||||
LcOpenMergeTool: "open external merge tool (git mergetool)",
|
||||
LcRefresh: "refresh",
|
||||
LcPush: "push",
|
||||
LcPull: "pull",
|
||||
@ -791,6 +795,8 @@ func englishTranslationSet() TranslationSet {
|
||||
CouldNotFindBinaryErr: "Could not find any binary at {{.url}}",
|
||||
AnonymousReportingTitle: "Help make lazygit better",
|
||||
AnonymousReportingPrompt: "Would you like to enable anonymous reporting data to help improve lazygit? (enter/esc)",
|
||||
MergeToolTitle: "Merge tool",
|
||||
MergeToolPrompt: "Are you sure you want to open `git mergetool`?",
|
||||
IntroPopupMessage: englishIntroPopupMessage,
|
||||
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
||||
LcEditFile: `edit file`,
|
||||
|
Loading…
Reference in New Issue
Block a user