1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

support copying stuff to clipboard

This commit is contained in:
Jesse Duffield 2020-04-15 20:30:24 +10:00 committed by github-actions[bot]
parent fcdcd1c335
commit 2974a57943
10 changed files with 57 additions and 135 deletions

View File

@ -91,6 +91,7 @@ Default path for the config file:
redo: '<c-z>' redo: '<c-z>'
filteringMenu: <c-s> filteringMenu: <c-s>
diffingMenu: '<c-e>' diffingMenu: '<c-e>'
copyToClipboard: '<c-o>'
status: status:
checkForUpdate: 'u' checkForUpdate: 'u'
recentRepos: '<enter>' recentRepos: '<enter>'

View File

@ -454,3 +454,14 @@ func RunLineOutputCmd(cmd *exec.Cmd, onLine func(line string) (bool, error)) err
cmd.Wait() cmd.Wait()
return nil return nil
} }
func (c *OSCommand) CopyToClipboard(str string) error {
commandTemplate := c.Config.GetUserConfig().GetString("os.copyToClipboardCommand")
templateValues := map[string]string{
"str": c.Quote(str),
}
command := utils.ResolvePlaceholderString(commandTemplate, templateValues)
return c.RunCommand(command)
}

View File

@ -322,6 +322,7 @@ keybinding:
redo: '<c-z>' redo: '<c-z>'
filteringMenu: <c-s> filteringMenu: <c-s>
diffingMenu: '<c-e>' diffingMenu: '<c-e>'
copyToClipboard: '<c-o>'
status: status:
checkForUpdate: 'u' checkForUpdate: 'u'
recentRepos: '<enter>' recentRepos: '<enter>'

View File

@ -7,5 +7,6 @@ func GetPlatformDefaultConfig() []byte {
return []byte( return []byte(
`os: `os:
openCommand: 'open {{filename}}' openCommand: 'open {{filename}}'
openLinkCommand: 'open {{link}}'`) openLinkCommand: 'open {{link}}'
copyToClipboardCommand: 'bash -c "echo -n {{str}} | pbcopy"'`)
} }

View File

@ -5,5 +5,6 @@ func GetPlatformDefaultConfig() []byte {
return []byte( return []byte(
`os: `os:
openCommand: 'sh -c "xdg-open {{filename}} >/dev/null"' openCommand: 'sh -c "xdg-open {{filename}} >/dev/null"'
openLinkCommand: 'sh -c "xdg-open {{link}} >/dev/null"'`) openLinkCommand: 'sh -c "xdg-open {{link}} >/dev/null"'
copyToClipboardCommand: 'bash -c "echo -n {{str}} | xclip -selection clipboard"'`)
} }

View File

@ -5,5 +5,6 @@ func GetPlatformDefaultConfig() []byte {
return []byte( return []byte(
`os: `os:
openCommand: 'cmd /c "start "" {{filename}}"' openCommand: 'cmd /c "start "" {{filename}}"'
openLinkCommand: 'cmd /c "start "" {{link}}"'`) openLinkCommand: 'cmd /c "start "" {{link}}"'
copyToClipboardCommand: 'cmd \c "echo -n {{str}} > /dev/clipboard"`)
} }

View File

@ -520,3 +520,12 @@ func (gui *Gui) currentBranch() *commands.Branch {
} }
return gui.State.Branches[0] return gui.State.Branches[0]
} }
func (gui *Gui) handleClipboardCopyBranch(g *gocui.Gui, v *gocui.View) error {
branch := gui.getSelectedBranch()
if branch == nil {
return nil
}
return gui.OSCommand.CopyToClipboard(branch.Name)
}

View File

@ -703,3 +703,12 @@ func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) err
return nil return nil
} }
func (gui *Gui) handleClipboardCopyCommit(g *gocui.Gui, v *gocui.View) error {
commit := gui.getSelectedCommit()
if commit == nil {
return nil
}
return gui.OSCommand.CopyToClipboard(commit.Sha)
}

View File

@ -222,7 +222,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.scrollUpMain"), Key: gui.getKey("universal.scrollUpMain"),
Modifier: gocui.ModNone,
Handler: gui.scrollUpMain, Handler: gui.scrollUpMain,
Alternative: "fn+up", Alternative: "fn+up",
Description: gui.Tr.SLocalize("scrollUpMainPanel"), Description: gui.Tr.SLocalize("scrollUpMainPanel"),
@ -230,7 +229,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.scrollDownMain"), Key: gui.getKey("universal.scrollDownMain"),
Modifier: gocui.ModNone,
Handler: gui.scrollDownMain, Handler: gui.scrollDownMain,
Alternative: "fn+down", Alternative: "fn+down",
Description: gui.Tr.SLocalize("scrollDownMainPanel"), Description: gui.Tr.SLocalize("scrollDownMainPanel"),
@ -262,42 +260,36 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.createRebaseOptionsMenu"), Key: gui.getKey("universal.createRebaseOptionsMenu"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateRebaseOptionsMenu, Handler: gui.handleCreateRebaseOptionsMenu,
Description: gui.Tr.SLocalize("ViewMergeRebaseOptions"), Description: gui.Tr.SLocalize("ViewMergeRebaseOptions"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.createPatchOptionsMenu"), Key: gui.getKey("universal.createPatchOptionsMenu"),
Modifier: gocui.ModNone,
Handler: gui.handleCreatePatchOptionsMenu, Handler: gui.handleCreatePatchOptionsMenu,
Description: gui.Tr.SLocalize("ViewPatchOptions"), Description: gui.Tr.SLocalize("ViewPatchOptions"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.pushFiles"), Key: gui.getKey("universal.pushFiles"),
Modifier: gocui.ModNone,
Handler: gui.pushFiles, Handler: gui.pushFiles,
Description: gui.Tr.SLocalize("push"), Description: gui.Tr.SLocalize("push"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.pullFiles"), Key: gui.getKey("universal.pullFiles"),
Modifier: gocui.ModNone,
Handler: gui.handlePullFiles, Handler: gui.handlePullFiles,
Description: gui.Tr.SLocalize("pull"), Description: gui.Tr.SLocalize("pull"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.refresh"), Key: gui.getKey("universal.refresh"),
Modifier: gocui.ModNone,
Handler: gui.handleRefresh, Handler: gui.handleRefresh,
Description: gui.Tr.SLocalize("refresh"), Description: gui.Tr.SLocalize("refresh"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.optionMenu"), Key: gui.getKey("universal.optionMenu"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateOptionsMenu, Handler: gui.handleCreateOptionsMenu,
Description: gui.Tr.SLocalize("openMenu"), Description: gui.Tr.SLocalize("openMenu"),
}, },
@ -316,182 +308,156 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.undo"), Key: gui.getKey("universal.undo"),
Modifier: gocui.ModNone,
Handler: gui.reflogUndo, Handler: gui.reflogUndo,
Description: gui.Tr.SLocalize("undoReflog"), Description: gui.Tr.SLocalize("undoReflog"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.redo"), Key: gui.getKey("universal.redo"),
Modifier: gocui.ModNone,
Handler: gui.reflogRedo, Handler: gui.reflogRedo,
Description: gui.Tr.SLocalize("redoReflog"), Description: gui.Tr.SLocalize("redoReflog"),
}, },
{ {
ViewName: "status", ViewName: "status",
Key: gui.getKey("universal.edit"), Key: gui.getKey("universal.edit"),
Modifier: gocui.ModNone,
Handler: gui.handleEditConfig, Handler: gui.handleEditConfig,
Description: gui.Tr.SLocalize("EditConfig"), Description: gui.Tr.SLocalize("EditConfig"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.nextScreenMode"), Key: gui.getKey("universal.nextScreenMode"),
Modifier: gocui.ModNone,
Handler: gui.nextScreenMode, Handler: gui.nextScreenMode,
Description: gui.Tr.SLocalize("nextScreenMode"), Description: gui.Tr.SLocalize("nextScreenMode"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.prevScreenMode"), Key: gui.getKey("universal.prevScreenMode"),
Modifier: gocui.ModNone,
Handler: gui.prevScreenMode, Handler: gui.prevScreenMode,
Description: gui.Tr.SLocalize("prevScreenMode"), Description: gui.Tr.SLocalize("prevScreenMode"),
}, },
{ {
ViewName: "status", ViewName: "status",
Key: gui.getKey("universal.openFile"), Key: gui.getKey("universal.openFile"),
Modifier: gocui.ModNone,
Handler: gui.handleOpenConfig, Handler: gui.handleOpenConfig,
Description: gui.Tr.SLocalize("OpenConfig"), Description: gui.Tr.SLocalize("OpenConfig"),
}, },
{ {
ViewName: "status", ViewName: "status",
Key: gui.getKey("status.checkForUpdate"), Key: gui.getKey("status.checkForUpdate"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckForUpdate, Handler: gui.handleCheckForUpdate,
Description: gui.Tr.SLocalize("checkForUpdate"), Description: gui.Tr.SLocalize("checkForUpdate"),
}, },
{ {
ViewName: "status", ViewName: "status",
Key: gui.getKey("status.recentRepos"), Key: gui.getKey("status.recentRepos"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateRecentReposMenu, Handler: gui.handleCreateRecentReposMenu,
Description: gui.Tr.SLocalize("SwitchRepo"), Description: gui.Tr.SLocalize("SwitchRepo"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.commitChanges"), Key: gui.getKey("files.commitChanges"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitPress, Handler: gui.handleCommitPress,
Description: gui.Tr.SLocalize("CommitChanges"), Description: gui.Tr.SLocalize("CommitChanges"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.commitChangesWithoutHook"), Key: gui.getKey("files.commitChangesWithoutHook"),
Modifier: gocui.ModNone,
Handler: gui.handleWIPCommitPress, Handler: gui.handleWIPCommitPress,
Description: gui.Tr.SLocalize("commitChangesWithoutHook"), Description: gui.Tr.SLocalize("commitChangesWithoutHook"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.amendLastCommit"), Key: gui.getKey("files.amendLastCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleAmendCommitPress, Handler: gui.handleAmendCommitPress,
Description: gui.Tr.SLocalize("AmendLastCommit"), Description: gui.Tr.SLocalize("AmendLastCommit"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.commitChangesWithEditor"), Key: gui.getKey("files.commitChangesWithEditor"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitEditorPress, Handler: gui.handleCommitEditorPress,
Description: gui.Tr.SLocalize("CommitChangesWithEditor"), Description: gui.Tr.SLocalize("CommitChangesWithEditor"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleFilePress, Handler: gui.handleFilePress,
Description: gui.Tr.SLocalize("toggleStaged"), Description: gui.Tr.SLocalize("toggleStaged"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateDiscardMenu, Handler: gui.handleCreateDiscardMenu,
Description: gui.Tr.SLocalize("viewDiscardOptions"), Description: gui.Tr.SLocalize("viewDiscardOptions"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("universal.edit"), Key: gui.getKey("universal.edit"),
Modifier: gocui.ModNone,
Handler: gui.handleFileEdit, Handler: gui.handleFileEdit,
Description: gui.Tr.SLocalize("editFile"), Description: gui.Tr.SLocalize("editFile"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("universal.openFile"), Key: gui.getKey("universal.openFile"),
Modifier: gocui.ModNone,
Handler: gui.handleFileOpen, Handler: gui.handleFileOpen,
Description: gui.Tr.SLocalize("openFile"), Description: gui.Tr.SLocalize("openFile"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.ignoreFile"), Key: gui.getKey("files.ignoreFile"),
Modifier: gocui.ModNone,
Handler: gui.handleIgnoreFile, Handler: gui.handleIgnoreFile,
Description: gui.Tr.SLocalize("ignoreFile"), Description: gui.Tr.SLocalize("ignoreFile"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.refreshFiles"), Key: gui.getKey("files.refreshFiles"),
Modifier: gocui.ModNone,
Handler: gui.handleRefreshFiles, Handler: gui.handleRefreshFiles,
Description: gui.Tr.SLocalize("refreshFiles"), Description: gui.Tr.SLocalize("refreshFiles"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.stashAllChanges"), Key: gui.getKey("files.stashAllChanges"),
Modifier: gocui.ModNone,
Handler: gui.handleStashChanges, Handler: gui.handleStashChanges,
Description: gui.Tr.SLocalize("stashAllChanges"), Description: gui.Tr.SLocalize("stashAllChanges"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.viewStashOptions"), Key: gui.getKey("files.viewStashOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateStashMenu, Handler: gui.handleCreateStashMenu,
Description: gui.Tr.SLocalize("viewStashOptions"), Description: gui.Tr.SLocalize("viewStashOptions"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.toggleStagedAll"), Key: gui.getKey("files.toggleStagedAll"),
Modifier: gocui.ModNone,
Handler: gui.handleStageAll, Handler: gui.handleStageAll,
Description: gui.Tr.SLocalize("toggleStagedAll"), Description: gui.Tr.SLocalize("toggleStagedAll"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.viewResetOptions"), Key: gui.getKey("files.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateResetMenu, Handler: gui.handleCreateResetMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("universal.goInto"), Key: gui.getKey("universal.goInto"),
Modifier: gocui.ModNone,
Handler: gui.handleEnterFile, Handler: gui.handleEnterFile,
Description: gui.Tr.SLocalize("StageLines"), Description: gui.Tr.SLocalize("StageLines"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("files.fetch"), Key: gui.getKey("files.fetch"),
Modifier: gocui.ModNone,
Handler: gui.handleGitFetch, Handler: gui.handleGitFetch,
Description: gui.Tr.SLocalize("fetch"), Description: gui.Tr.SLocalize("fetch"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.executeCustomCommand"), Key: gui.getKey("universal.executeCustomCommand"),
Modifier: gocui.ModNone,
Handler: gui.handleCustomCommand, Handler: gui.handleCustomCommand,
Description: gui.Tr.SLocalize("executeCustomCommand"), Description: gui.Tr.SLocalize("executeCustomCommand"),
}, },
{ {
ViewName: "files", ViewName: "files",
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateResetToUpstreamMenu, Handler: gui.handleCreateResetToUpstreamMenu,
Description: gui.Tr.SLocalize("viewResetToUpstreamOptions"), Description: gui.Tr.SLocalize("viewResetToUpstreamOptions"),
}, },
@ -499,7 +465,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleBranchPress, Handler: gui.handleBranchPress,
Description: gui.Tr.SLocalize("checkout"), Description: gui.Tr.SLocalize("checkout"),
}, },
@ -507,7 +472,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.createPullRequest"), Key: gui.getKey("branches.createPullRequest"),
Modifier: gocui.ModNone,
Handler: gui.handleCreatePullRequestPress, Handler: gui.handleCreatePullRequestPress,
Description: gui.Tr.SLocalize("createPullRequest"), Description: gui.Tr.SLocalize("createPullRequest"),
}, },
@ -515,7 +479,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.checkoutBranchByName"), Key: gui.getKey("branches.checkoutBranchByName"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckoutByName, Handler: gui.handleCheckoutByName,
Description: gui.Tr.SLocalize("checkoutByName"), Description: gui.Tr.SLocalize("checkoutByName"),
}, },
@ -523,7 +486,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.forceCheckoutBranch"), Key: gui.getKey("branches.forceCheckoutBranch"),
Modifier: gocui.ModNone,
Handler: gui.handleForceCheckout, Handler: gui.handleForceCheckout,
Description: gui.Tr.SLocalize("forceCheckout"), Description: gui.Tr.SLocalize("forceCheckout"),
}, },
@ -531,7 +493,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("universal.new"), Key: gui.getKey("universal.new"),
Modifier: gocui.ModNone,
Handler: gui.handleNewBranch, Handler: gui.handleNewBranch,
Description: gui.Tr.SLocalize("newBranch"), Description: gui.Tr.SLocalize("newBranch"),
}, },
@ -539,7 +500,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleDeleteBranch, Handler: gui.handleDeleteBranch,
Description: gui.Tr.SLocalize("deleteBranch"), Description: gui.Tr.SLocalize("deleteBranch"),
}, },
@ -547,7 +507,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.rebaseBranch"), Key: gui.getKey("branches.rebaseBranch"),
Modifier: gocui.ModNone,
Handler: gui.handleRebaseOntoLocalBranch, Handler: gui.handleRebaseOntoLocalBranch,
Description: gui.Tr.SLocalize("rebaseBranch"), Description: gui.Tr.SLocalize("rebaseBranch"),
}, },
@ -555,7 +514,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.mergeIntoCurrentBranch"), Key: gui.getKey("branches.mergeIntoCurrentBranch"),
Modifier: gocui.ModNone,
Handler: gui.handleMerge, Handler: gui.handleMerge,
Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"), Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"),
}, },
@ -563,7 +521,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.viewGitFlowOptions"), Key: gui.getKey("branches.viewGitFlowOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateGitFlowMenu, Handler: gui.handleCreateGitFlowMenu,
Description: gui.Tr.SLocalize("gitFlowOptions"), Description: gui.Tr.SLocalize("gitFlowOptions"),
}, },
@ -571,7 +528,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.FastForward"), Key: gui.getKey("branches.FastForward"),
Modifier: gocui.ModNone,
Handler: gui.handleFastForward, Handler: gui.handleFastForward,
Description: gui.Tr.SLocalize("FastForward"), Description: gui.Tr.SLocalize("FastForward"),
}, },
@ -579,7 +535,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateResetToBranchMenu, Handler: gui.handleCreateResetToBranchMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
}, },
@ -587,15 +542,20 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"local-branches"}, Contexts: []string{"local-branches"},
Key: gui.getKey("branches.renameBranch"), Key: gui.getKey("branches.renameBranch"),
Modifier: gocui.ModNone,
Handler: gui.handleRenameBranch, Handler: gui.handleRenameBranch,
Description: gui.Tr.SLocalize("renameBranch"), Description: gui.Tr.SLocalize("renameBranch"),
}, },
{
ViewName: "branches",
Contexts: []string{"local-branches"},
Key: gui.getKey("universal.copyToClipboard"),
Handler: gui.handleClipboardCopyBranch,
Description: gui.Tr.SLocalize("copyBranchNameToClipboard"),
},
{ {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"tags"}, Contexts: []string{"tags"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckoutTag, Handler: gui.handleCheckoutTag,
Description: gui.Tr.SLocalize("checkout"), Description: gui.Tr.SLocalize("checkout"),
}, },
@ -603,7 +563,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"tags"}, Contexts: []string{"tags"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleDeleteTag, Handler: gui.handleDeleteTag,
Description: gui.Tr.SLocalize("deleteTag"), Description: gui.Tr.SLocalize("deleteTag"),
}, },
@ -611,7 +570,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"tags"}, Contexts: []string{"tags"},
Key: gui.getKey("branches.pushTag"), Key: gui.getKey("branches.pushTag"),
Modifier: gocui.ModNone,
Handler: gui.handlePushTag, Handler: gui.handlePushTag,
Description: gui.Tr.SLocalize("pushTag"), Description: gui.Tr.SLocalize("pushTag"),
}, },
@ -619,7 +577,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"tags"}, Contexts: []string{"tags"},
Key: gui.getKey("universal.new"), Key: gui.getKey("universal.new"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateTag, Handler: gui.handleCreateTag,
Description: gui.Tr.SLocalize("createTag"), Description: gui.Tr.SLocalize("createTag"),
}, },
@ -627,21 +584,18 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"tags"}, Contexts: []string{"tags"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateResetToTagMenu, Handler: gui.handleCreateResetToTagMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Key: gui.getKey("universal.nextTab"), Key: gui.getKey("universal.nextTab"),
Modifier: gocui.ModNone,
Handler: gui.handleNextBranchesTab, Handler: gui.handleNextBranchesTab,
Description: gui.Tr.SLocalize("nextTab"), Description: gui.Tr.SLocalize("nextTab"),
}, },
{ {
ViewName: "branches", ViewName: "branches",
Key: gui.getKey("universal.prevTab"), Key: gui.getKey("universal.prevTab"),
Modifier: gocui.ModNone,
Handler: gui.handlePrevBranchesTab, Handler: gui.handlePrevBranchesTab,
Description: gui.Tr.SLocalize("prevTab"), Description: gui.Tr.SLocalize("prevTab"),
}, },
@ -649,7 +603,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Modifier: gocui.ModNone,
Handler: gui.handleRemoteBranchesEscape, Handler: gui.handleRemoteBranchesEscape,
Description: gui.Tr.SLocalize("ReturnToRemotesList"), Description: gui.Tr.SLocalize("ReturnToRemotesList"),
}, },
@ -657,7 +610,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateResetToRemoteBranchMenu, Handler: gui.handleCreateResetToRemoteBranchMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
}, },
@ -665,21 +617,18 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remotes"}, Contexts: []string{"remotes"},
Key: gui.getKey("branches.fetchRemote"), Key: gui.getKey("branches.fetchRemote"),
Modifier: gocui.ModNone,
Handler: gui.handleFetchRemote, Handler: gui.handleFetchRemote,
Description: gui.Tr.SLocalize("fetchRemote"), Description: gui.Tr.SLocalize("fetchRemote"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Key: gui.getKey("universal.nextTab"), Key: gui.getKey("universal.nextTab"),
Modifier: gocui.ModNone,
Handler: gui.handleNextCommitsTab, Handler: gui.handleNextCommitsTab,
Description: gui.Tr.SLocalize("nextTab"), Description: gui.Tr.SLocalize("nextTab"),
}, },
{ {
ViewName: "commits", ViewName: "commits",
Key: gui.getKey("universal.prevTab"), Key: gui.getKey("universal.prevTab"),
Modifier: gocui.ModNone,
Handler: gui.handlePrevCommitsTab, Handler: gui.handlePrevCommitsTab,
Description: gui.Tr.SLocalize("prevTab"), Description: gui.Tr.SLocalize("prevTab"),
}, },
@ -687,7 +636,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.squashDown"), Key: gui.getKey("commits.squashDown"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitSquashDown, Handler: gui.handleCommitSquashDown,
Description: gui.Tr.SLocalize("squashDown"), Description: gui.Tr.SLocalize("squashDown"),
}, },
@ -695,7 +643,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.renameCommit"), Key: gui.getKey("commits.renameCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleRenameCommit, Handler: gui.handleRenameCommit,
Description: gui.Tr.SLocalize("renameCommit"), Description: gui.Tr.SLocalize("renameCommit"),
}, },
@ -703,7 +650,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.renameCommitWithEditor"), Key: gui.getKey("commits.renameCommitWithEditor"),
Modifier: gocui.ModNone,
Handler: gui.handleRenameCommitEditor, Handler: gui.handleRenameCommitEditor,
Description: gui.Tr.SLocalize("renameCommitEditor"), Description: gui.Tr.SLocalize("renameCommitEditor"),
}, },
@ -711,7 +657,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateCommitResetMenu, Handler: gui.handleCreateCommitResetMenu,
Description: gui.Tr.SLocalize("resetToThisCommit"), Description: gui.Tr.SLocalize("resetToThisCommit"),
}, },
@ -719,7 +664,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.markCommitAsFixup"), Key: gui.getKey("commits.markCommitAsFixup"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitFixup, Handler: gui.handleCommitFixup,
Description: gui.Tr.SLocalize("fixupCommit"), Description: gui.Tr.SLocalize("fixupCommit"),
}, },
@ -727,7 +671,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.createFixupCommit"), Key: gui.getKey("commits.createFixupCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateFixupCommit, Handler: gui.handleCreateFixupCommit,
Description: gui.Tr.SLocalize("createFixupCommit"), Description: gui.Tr.SLocalize("createFixupCommit"),
}, },
@ -735,7 +678,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.squashAboveCommits"), Key: gui.getKey("commits.squashAboveCommits"),
Modifier: gocui.ModNone,
Handler: gui.handleSquashAllAboveFixupCommits, Handler: gui.handleSquashAllAboveFixupCommits,
Description: gui.Tr.SLocalize("squashAboveCommits"), Description: gui.Tr.SLocalize("squashAboveCommits"),
}, },
@ -743,7 +685,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitDelete, Handler: gui.handleCommitDelete,
Description: gui.Tr.SLocalize("deleteCommit"), Description: gui.Tr.SLocalize("deleteCommit"),
}, },
@ -751,7 +692,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.moveDownCommit"), Key: gui.getKey("commits.moveDownCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitMoveDown, Handler: gui.handleCommitMoveDown,
Description: gui.Tr.SLocalize("moveDownCommit"), Description: gui.Tr.SLocalize("moveDownCommit"),
}, },
@ -759,7 +699,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.moveUpCommit"), Key: gui.getKey("commits.moveUpCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitMoveUp, Handler: gui.handleCommitMoveUp,
Description: gui.Tr.SLocalize("moveUpCommit"), Description: gui.Tr.SLocalize("moveUpCommit"),
}, },
@ -767,7 +706,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("universal.edit"), Key: gui.getKey("universal.edit"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitEdit, Handler: gui.handleCommitEdit,
Description: gui.Tr.SLocalize("editCommit"), Description: gui.Tr.SLocalize("editCommit"),
}, },
@ -775,7 +713,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.amendToCommit"), Key: gui.getKey("commits.amendToCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitAmendTo, Handler: gui.handleCommitAmendTo,
Description: gui.Tr.SLocalize("amendToCommit"), Description: gui.Tr.SLocalize("amendToCommit"),
}, },
@ -783,7 +720,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.pickCommit"), Key: gui.getKey("commits.pickCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitPick, Handler: gui.handleCommitPick,
Description: gui.Tr.SLocalize("pickCommit"), Description: gui.Tr.SLocalize("pickCommit"),
}, },
@ -791,7 +727,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.revertCommit"), Key: gui.getKey("commits.revertCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitRevert, Handler: gui.handleCommitRevert,
Description: gui.Tr.SLocalize("revertCommit"), Description: gui.Tr.SLocalize("revertCommit"),
}, },
@ -799,15 +734,20 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.cherryPickCopy"), Key: gui.getKey("commits.cherryPickCopy"),
Modifier: gocui.ModNone,
Handler: gui.handleCopyCommit, Handler: gui.handleCopyCommit,
Description: gui.Tr.SLocalize("cherryPickCopy"), Description: gui.Tr.SLocalize("cherryPickCopy"),
}, },
{
ViewName: "commits",
Contexts: []string{"branch-commits"},
Key: gui.getKey("universal.copyToClipboard"),
Handler: gui.handleClipboardCopyCommit,
Description: gui.Tr.SLocalize("copyCommitShaToClipboard"),
},
{ {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.cherryPickCopyRange"), Key: gui.getKey("commits.cherryPickCopyRange"),
Modifier: gocui.ModNone,
Handler: gui.handleCopyCommitRange, Handler: gui.handleCopyCommitRange,
Description: gui.Tr.SLocalize("cherryPickCopyRange"), Description: gui.Tr.SLocalize("cherryPickCopyRange"),
}, },
@ -815,7 +755,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.pasteCommits"), Key: gui.getKey("commits.pasteCommits"),
Modifier: gocui.ModNone,
Handler: gui.HandlePasteCommits, Handler: gui.HandlePasteCommits,
Description: gui.Tr.SLocalize("pasteCommits"), Description: gui.Tr.SLocalize("pasteCommits"),
}, },
@ -823,7 +762,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("universal.goInto"), Key: gui.getKey("universal.goInto"),
Modifier: gocui.ModNone,
Handler: gui.handleSwitchToCommitFilesPanel, Handler: gui.handleSwitchToCommitFilesPanel,
Description: gui.Tr.SLocalize("viewCommitFiles"), Description: gui.Tr.SLocalize("viewCommitFiles"),
}, },
@ -831,7 +769,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.checkoutCommit"), Key: gui.getKey("commits.checkoutCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckoutCommit, Handler: gui.handleCheckoutCommit,
Description: gui.Tr.SLocalize("checkoutCommit"), Description: gui.Tr.SLocalize("checkoutCommit"),
}, },
@ -839,7 +776,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.tagCommit"), Key: gui.getKey("commits.tagCommit"),
Modifier: gocui.ModNone,
Handler: gui.handleTagCommit, Handler: gui.handleTagCommit,
Description: gui.Tr.SLocalize("tagCommit"), Description: gui.Tr.SLocalize("tagCommit"),
}, },
@ -847,7 +783,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"branch-commits"}, Contexts: []string{"branch-commits"},
Key: gui.getKey("commits.resetCherryPick"), Key: gui.getKey("commits.resetCherryPick"),
Modifier: gocui.ModNone,
Handler: gui.handleResetCherryPick, Handler: gui.handleResetCherryPick,
Description: gui.Tr.SLocalize("resetCherryPick"), Description: gui.Tr.SLocalize("resetCherryPick"),
}, },
@ -855,7 +790,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"reflog-commits"}, Contexts: []string{"reflog-commits"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckoutReflogCommit, Handler: gui.handleCheckoutReflogCommit,
Description: gui.Tr.SLocalize("checkoutCommit"), Description: gui.Tr.SLocalize("checkoutCommit"),
}, },
@ -863,28 +797,24 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "commits", ViewName: "commits",
Contexts: []string{"reflog-commits"}, Contexts: []string{"reflog-commits"},
Key: gui.getKey("commits.viewResetOptions"), Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateReflogResetMenu, Handler: gui.handleCreateReflogResetMenu,
Description: gui.Tr.SLocalize("viewResetOptions"), Description: gui.Tr.SLocalize("viewResetOptions"),
}, },
{ {
ViewName: "stash", ViewName: "stash",
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleStashApply, Handler: gui.handleStashApply,
Description: gui.Tr.SLocalize("apply"), Description: gui.Tr.SLocalize("apply"),
}, },
{ {
ViewName: "stash", ViewName: "stash",
Key: gui.getKey("stash.popStash"), Key: gui.getKey("stash.popStash"),
Modifier: gocui.ModNone,
Handler: gui.handleStashPop, Handler: gui.handleStashPop,
Description: gui.Tr.SLocalize("pop"), Description: gui.Tr.SLocalize("pop"),
}, },
{ {
ViewName: "stash", ViewName: "stash",
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleStashDrop, Handler: gui.handleStashDrop,
Description: gui.Tr.SLocalize("drop"), Description: gui.Tr.SLocalize("drop"),
}, },
@ -915,14 +845,12 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "menu", ViewName: "menu",
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Modifier: gocui.ModNone,
Handler: gui.handleMenuClose, Handler: gui.handleMenuClose,
Description: gui.Tr.SLocalize("closeMenu"), Description: gui.Tr.SLocalize("closeMenu"),
}, },
{ {
ViewName: "menu", ViewName: "menu",
Key: gui.getKey("universal.quit"), Key: gui.getKey("universal.quit"),
Modifier: gocui.ModNone,
Handler: gui.handleMenuClose, Handler: gui.handleMenuClose,
Description: gui.Tr.SLocalize("closeMenu"), Description: gui.Tr.SLocalize("closeMenu"),
}, },
@ -935,56 +863,48 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Modifier: gocui.ModNone,
Handler: gui.handleSwitchToCommitsPanel, Handler: gui.handleSwitchToCommitsPanel,
Description: gui.Tr.SLocalize("goBack"), Description: gui.Tr.SLocalize("goBack"),
}, },
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: gui.getKey("commitFiles.checkoutCommitFile"), Key: gui.getKey("commitFiles.checkoutCommitFile"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckoutCommitFile, Handler: gui.handleCheckoutCommitFile,
Description: gui.Tr.SLocalize("checkoutCommitFile"), Description: gui.Tr.SLocalize("checkoutCommitFile"),
}, },
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleDiscardOldFileChange, Handler: gui.handleDiscardOldFileChange,
Description: gui.Tr.SLocalize("discardOldFileChange"), Description: gui.Tr.SLocalize("discardOldFileChange"),
}, },
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: gui.getKey("universal.openFile"), Key: gui.getKey("universal.openFile"),
Modifier: gocui.ModNone,
Handler: gui.handleOpenOldCommitFile, Handler: gui.handleOpenOldCommitFile,
Description: gui.Tr.SLocalize("openFile"), Description: gui.Tr.SLocalize("openFile"),
}, },
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleToggleFileForPatch, Handler: gui.handleToggleFileForPatch,
Description: gui.Tr.SLocalize("toggleAddToPatch"), Description: gui.Tr.SLocalize("toggleAddToPatch"),
}, },
{ {
ViewName: "commitFiles", ViewName: "commitFiles",
Key: gui.getKey("universal.goInto"), Key: gui.getKey("universal.goInto"),
Modifier: gocui.ModNone,
Handler: gui.handleEnterCommitFile, Handler: gui.handleEnterCommitFile,
Description: gui.Tr.SLocalize("enterFile"), Description: gui.Tr.SLocalize("enterFile"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.filteringMenu"), Key: gui.getKey("universal.filteringMenu"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateFilteringMenuPanel, Handler: gui.handleCreateFilteringMenuPanel,
Description: gui.Tr.SLocalize("openScopingMenu"), Description: gui.Tr.SLocalize("openScopingMenu"),
}, },
{ {
ViewName: "", ViewName: "",
Key: gui.getKey("universal.diffingMenu"), Key: gui.getKey("universal.diffingMenu"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateDiffingMenuPanel, Handler: gui.handleCreateDiffingMenuPanel,
Description: gui.Tr.SLocalize("openDiffingMenu"), Description: gui.Tr.SLocalize("openDiffingMenu"),
}, },
@ -1011,7 +931,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"normal"}, Contexts: []string{"normal"},
Key: gocui.MouseWheelDown, Key: gocui.MouseWheelDown,
Modifier: gocui.ModNone,
Handler: gui.scrollDownMain, Handler: gui.scrollDownMain,
Description: gui.Tr.SLocalize("ScrollDown"), Description: gui.Tr.SLocalize("ScrollDown"),
Alternative: "fn+up", Alternative: "fn+up",
@ -1020,7 +939,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"normal"}, Contexts: []string{"normal"},
Key: gocui.MouseWheelUp, Key: gocui.MouseWheelUp,
Modifier: gocui.ModNone,
Handler: gui.scrollUpMain, Handler: gui.scrollUpMain,
Description: gui.Tr.SLocalize("ScrollUp"), Description: gui.Tr.SLocalize("ScrollUp"),
Alternative: "fn+down", Alternative: "fn+down",
@ -1043,7 +961,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Modifier: gocui.ModNone,
Handler: gui.handleStagingEscape, Handler: gui.handleStagingEscape,
Description: gui.Tr.SLocalize("ReturnToFilesPanel"), Description: gui.Tr.SLocalize("ReturnToFilesPanel"),
}, },
@ -1051,7 +968,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleToggleStagedSelection, Handler: gui.handleToggleStagedSelection,
Description: gui.Tr.SLocalize("StageSelection"), Description: gui.Tr.SLocalize("StageSelection"),
}, },
@ -1059,7 +975,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleResetSelection, Handler: gui.handleResetSelection,
Description: gui.Tr.SLocalize("ResetSelection"), Description: gui.Tr.SLocalize("ResetSelection"),
}, },
@ -1067,7 +982,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("universal.togglePanel"), Key: gui.getKey("universal.togglePanel"),
Modifier: gocui.ModNone,
Handler: gui.handleTogglePanel, Handler: gui.handleTogglePanel,
Description: gui.Tr.SLocalize("TogglePanel"), Description: gui.Tr.SLocalize("TogglePanel"),
}, },
@ -1075,7 +989,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building"}, Contexts: []string{"patch-building"},
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Modifier: gocui.ModNone,
Handler: gui.handleEscapePatchBuildingPanel, Handler: gui.handleEscapePatchBuildingPanel,
Description: gui.Tr.SLocalize("ExitLineByLineMode"), Description: gui.Tr.SLocalize("ExitLineByLineMode"),
}, },
@ -1083,7 +996,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("universal.prevItem"), Key: gui.getKey("universal.prevItem"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectPrevLine, Handler: gui.handleSelectPrevLine,
Description: gui.Tr.SLocalize("PrevLine"), Description: gui.Tr.SLocalize("PrevLine"),
}, },
@ -1091,7 +1003,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("universal.nextItem"), Key: gui.getKey("universal.nextItem"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectNextLine, Handler: gui.handleSelectNextLine,
Description: gui.Tr.SLocalize("NextLine"), Description: gui.Tr.SLocalize("NextLine"),
}, },
@ -1127,7 +1038,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("universal.prevBlock"), Key: gui.getKey("universal.prevBlock"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectPrevHunk, Handler: gui.handleSelectPrevHunk,
Description: gui.Tr.SLocalize("PrevHunk"), Description: gui.Tr.SLocalize("PrevHunk"),
}, },
@ -1135,7 +1045,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("universal.nextBlock"), Key: gui.getKey("universal.nextBlock"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectNextHunk, Handler: gui.handleSelectNextHunk,
Description: gui.Tr.SLocalize("NextHunk"), Description: gui.Tr.SLocalize("NextHunk"),
}, },
@ -1157,7 +1066,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("universal.edit"), Key: gui.getKey("universal.edit"),
Modifier: gocui.ModNone,
Handler: gui.handleFileEdit, Handler: gui.handleFileEdit,
Description: gui.Tr.SLocalize("editFile"), Description: gui.Tr.SLocalize("editFile"),
}, },
@ -1165,7 +1073,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("universal.openFile"), Key: gui.getKey("universal.openFile"),
Modifier: gocui.ModNone,
Handler: gui.handleFileOpen, Handler: gui.handleFileOpen,
Description: gui.Tr.SLocalize("openFile"), Description: gui.Tr.SLocalize("openFile"),
}, },
@ -1173,7 +1080,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building"}, Contexts: []string{"patch-building"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleToggleSelectionForPatch, Handler: gui.handleToggleSelectionForPatch,
Description: gui.Tr.SLocalize("ToggleSelectionForPatch"), Description: gui.Tr.SLocalize("ToggleSelectionForPatch"),
}, },
@ -1181,7 +1087,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("main.toggleDragSelect"), Key: gui.getKey("main.toggleDragSelect"),
Modifier: gocui.ModNone,
Handler: gui.handleToggleSelectRange, Handler: gui.handleToggleSelectRange,
Description: gui.Tr.SLocalize("ToggleDragSelect"), Description: gui.Tr.SLocalize("ToggleDragSelect"),
}, },
@ -1190,7 +1095,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("main.toggleDragSelect-alt"), Key: gui.getKey("main.toggleDragSelect-alt"),
Modifier: gocui.ModNone,
Handler: gui.handleToggleSelectRange, Handler: gui.handleToggleSelectRange,
Description: gui.Tr.SLocalize("ToggleDragSelect"), Description: gui.Tr.SLocalize("ToggleDragSelect"),
}, },
@ -1198,7 +1102,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"patch-building", "staging"}, Contexts: []string{"patch-building", "staging"},
Key: gui.getKey("main.toggleSelectHunk"), Key: gui.getKey("main.toggleSelectHunk"),
Modifier: gocui.ModNone,
Handler: gui.handleToggleSelectHunk, Handler: gui.handleToggleSelectHunk,
Description: gui.Tr.SLocalize("ToggleSelectHunk"), Description: gui.Tr.SLocalize("ToggleSelectHunk"),
}, },
@ -1234,7 +1137,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("files.commitChanges"), Key: gui.getKey("files.commitChanges"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitPress, Handler: gui.handleCommitPress,
Description: gui.Tr.SLocalize("CommitChanges"), Description: gui.Tr.SLocalize("CommitChanges"),
}, },
@ -1242,7 +1144,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("files.commitChangesWithoutHook"), Key: gui.getKey("files.commitChangesWithoutHook"),
Modifier: gocui.ModNone,
Handler: gui.handleWIPCommitPress, Handler: gui.handleWIPCommitPress,
Description: gui.Tr.SLocalize("commitChangesWithoutHook"), Description: gui.Tr.SLocalize("commitChangesWithoutHook"),
}, },
@ -1250,7 +1151,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"staging"}, Contexts: []string{"staging"},
Key: gui.getKey("files.commitChangesWithEditor"), Key: gui.getKey("files.commitChangesWithEditor"),
Modifier: gocui.ModNone,
Handler: gui.handleCommitEditorPress, Handler: gui.handleCommitEditorPress,
Description: gui.Tr.SLocalize("CommitChangesWithEditor"), Description: gui.Tr.SLocalize("CommitChangesWithEditor"),
}, },
@ -1258,7 +1158,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.return"), Key: gui.getKey("universal.return"),
Modifier: gocui.ModNone,
Handler: gui.handleEscapeMerge, Handler: gui.handleEscapeMerge,
Description: gui.Tr.SLocalize("ReturnToFilesPanel"), Description: gui.Tr.SLocalize("ReturnToFilesPanel"),
}, },
@ -1266,7 +1165,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handlePickHunk, Handler: gui.handlePickHunk,
Description: gui.Tr.SLocalize("PickHunk"), Description: gui.Tr.SLocalize("PickHunk"),
}, },
@ -1274,7 +1172,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("main.pickBothHunks"), Key: gui.getKey("main.pickBothHunks"),
Modifier: gocui.ModNone,
Handler: gui.handlePickBothHunks, Handler: gui.handlePickBothHunks,
Description: gui.Tr.SLocalize("PickBothHunks"), Description: gui.Tr.SLocalize("PickBothHunks"),
}, },
@ -1282,7 +1179,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.prevBlock"), Key: gui.getKey("universal.prevBlock"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectPrevConflict, Handler: gui.handleSelectPrevConflict,
Description: gui.Tr.SLocalize("PrevConflict"), Description: gui.Tr.SLocalize("PrevConflict"),
}, },
@ -1290,7 +1186,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.nextBlock"), Key: gui.getKey("universal.nextBlock"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectNextConflict, Handler: gui.handleSelectNextConflict,
Description: gui.Tr.SLocalize("NextConflict"), Description: gui.Tr.SLocalize("NextConflict"),
}, },
@ -1298,7 +1193,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.prevItem"), Key: gui.getKey("universal.prevItem"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectTop, Handler: gui.handleSelectTop,
Description: gui.Tr.SLocalize("SelectTop"), Description: gui.Tr.SLocalize("SelectTop"),
}, },
@ -1306,7 +1200,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.nextItem"), Key: gui.getKey("universal.nextItem"),
Modifier: gocui.ModNone,
Handler: gui.handleSelectBottom, Handler: gui.handleSelectBottom,
Description: gui.Tr.SLocalize("SelectBottom"), Description: gui.Tr.SLocalize("SelectBottom"),
}, },
@ -1356,7 +1249,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "main", ViewName: "main",
Contexts: []string{"merging"}, Contexts: []string{"merging"},
Key: gui.getKey("universal.undo"), Key: gui.getKey("universal.undo"),
Modifier: gocui.ModNone,
Handler: gui.handlePopFileSnapshot, Handler: gui.handlePopFileSnapshot,
Description: gui.Tr.SLocalize("undo"), Description: gui.Tr.SLocalize("undo"),
}, },
@ -1371,7 +1263,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remotes"}, Contexts: []string{"remotes"},
Key: gui.getKey("universal.new"), Key: gui.getKey("universal.new"),
Modifier: gocui.ModNone,
Handler: gui.handleAddRemote, Handler: gui.handleAddRemote,
Description: gui.Tr.SLocalize("addNewRemote"), Description: gui.Tr.SLocalize("addNewRemote"),
}, },
@ -1379,7 +1270,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remotes"}, Contexts: []string{"remotes"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleRemoveRemote, Handler: gui.handleRemoveRemote,
Description: gui.Tr.SLocalize("removeRemote"), Description: gui.Tr.SLocalize("removeRemote"),
}, },
@ -1387,7 +1277,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remotes"}, Contexts: []string{"remotes"},
Key: gui.getKey("universal.edit"), Key: gui.getKey("universal.edit"),
Modifier: gocui.ModNone,
Handler: gui.handleEditRemote, Handler: gui.handleEditRemote,
Description: gui.Tr.SLocalize("editRemote"), Description: gui.Tr.SLocalize("editRemote"),
}, },
@ -1395,7 +1284,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("universal.select"), Key: gui.getKey("universal.select"),
Modifier: gocui.ModNone,
Handler: gui.handleCheckoutRemoteBranch, Handler: gui.handleCheckoutRemoteBranch,
Description: gui.Tr.SLocalize("checkout"), Description: gui.Tr.SLocalize("checkout"),
}, },
@ -1403,7 +1291,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("branches.mergeIntoCurrentBranch"), Key: gui.getKey("branches.mergeIntoCurrentBranch"),
Modifier: gocui.ModNone,
Handler: gui.handleMergeRemoteBranch, Handler: gui.handleMergeRemoteBranch,
Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"), Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"),
}, },
@ -1411,7 +1298,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("universal.remove"), Key: gui.getKey("universal.remove"),
Modifier: gocui.ModNone,
Handler: gui.handleDeleteRemoteBranch, Handler: gui.handleDeleteRemoteBranch,
Description: gui.Tr.SLocalize("deleteBranch"), Description: gui.Tr.SLocalize("deleteBranch"),
}, },
@ -1419,7 +1305,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("branches.rebaseBranch"), Key: gui.getKey("branches.rebaseBranch"),
Modifier: gocui.ModNone,
Handler: gui.handleRebaseOntoRemoteBranch, Handler: gui.handleRebaseOntoRemoteBranch,
Description: gui.Tr.SLocalize("rebaseBranch"), Description: gui.Tr.SLocalize("rebaseBranch"),
}, },
@ -1427,7 +1312,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: "branches", ViewName: "branches",
Contexts: []string{"remote-branches"}, Contexts: []string{"remote-branches"},
Key: gui.getKey("branches.setUpstream"), Key: gui.getKey("branches.setUpstream"),
Modifier: gocui.ModNone,
Handler: gui.handleSetBranchUpstream, Handler: gui.handleSetBranchUpstream,
Description: gui.Tr.SLocalize("setUpstream"), Description: gui.Tr.SLocalize("setUpstream"),
}, },
@ -1529,7 +1413,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: listView.viewName, ViewName: listView.viewName,
Contexts: []string{listView.context}, Contexts: []string{listView.context},
Key: gui.getKey("universal.startSearch"), Key: gui.getKey("universal.startSearch"),
Modifier: gocui.ModNone,
Handler: openSearchHandler, Handler: openSearchHandler,
Description: gui.Tr.SLocalize("startSearch"), Description: gui.Tr.SLocalize("startSearch"),
}, },
@ -1537,7 +1420,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
ViewName: listView.viewName, ViewName: listView.viewName,
Contexts: []string{listView.context}, Contexts: []string{listView.context},
Key: gui.getKey("universal.gotoBottom"), Key: gui.getKey("universal.gotoBottom"),
Modifier: gocui.ModNone,
Handler: gotoBottomHandler, Handler: gotoBottomHandler,
Description: gui.Tr.SLocalize("gotoBottom"), Description: gui.Tr.SLocalize("gotoBottom"),
}, },

View File

@ -1131,6 +1131,12 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{ }, &i18n.Message{
ID: "showingGitDiff", ID: "showingGitDiff",
Other: "showing output for:", Other: "showing output for:",
}, &i18n.Message{
ID: "copyCommitShaToClipboard",
Other: "copy commit SHA to clipboard",
}, &i18n.Message{
ID: "copyBranchNameToClipboard",
Other: "copy branch name to clipboard",
}, },
) )
} }