diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/config/user_config.go | 75 | ||||
-rw-r--r-- | pkg/gui/commits_panel.go | 13 | ||||
-rw-r--r-- | pkg/gui/keybindings.go | 7 | ||||
-rw-r--r-- | pkg/i18n/dutch.go | 1 | ||||
-rw-r--r-- | pkg/i18n/english.go | 2 |
5 files changed, 62 insertions, 36 deletions
diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index a46f9bf1e..0376fd0fa 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -180,24 +180,25 @@ type KeybindingBranchesConfig struct { } type KeybindingCommitsConfig struct { - SquashDown string `yaml:"squashDown"` - RenameCommit string `yaml:"renameCommit"` - RenameCommitWithEditor string `yaml:"renameCommitWithEditor"` - ViewResetOptions string `yaml:"viewResetOptions"` - MarkCommitAsFixup string `yaml:"markCommitAsFixup"` - CreateFixupCommit string `yaml:"createFixupCommit"` - SquashAboveCommits string `yaml:"squashAboveCommits"` - MoveDownCommit string `yaml:"moveDownCommit"` - MoveUpCommit string `yaml:"moveUpCommit"` - AmendToCommit string `yaml:"amendToCommit"` - PickCommit string `yaml:"pickCommit"` - RevertCommit string `yaml:"revertCommit"` - CherryPickCopy string `yaml:"cherryPickCopy"` - CherryPickCopyRange string `yaml:"cherryPickCopyRange"` - PasteCommits string `yaml:"pasteCommits"` - TagCommit string `yaml:"tagCommit"` - CheckoutCommit string `yaml:"checkoutCommit"` - ResetCherryPick string `yaml:"resetCherryPick"` + SquashDown string `yaml:"squashDown"` + RenameCommit string `yaml:"renameCommit"` + RenameCommitWithEditor string `yaml:"renameCommitWithEditor"` + ViewResetOptions string `yaml:"viewResetOptions"` + MarkCommitAsFixup string `yaml:"markCommitAsFixup"` + CreateFixupCommit string `yaml:"createFixupCommit"` + SquashAboveCommits string `yaml:"squashAboveCommits"` + MoveDownCommit string `yaml:"moveDownCommit"` + MoveUpCommit string `yaml:"moveUpCommit"` + AmendToCommit string `yaml:"amendToCommit"` + PickCommit string `yaml:"pickCommit"` + RevertCommit string `yaml:"revertCommit"` + CherryPickCopy string `yaml:"cherryPickCopy"` + CherryPickCopyRange string `yaml:"cherryPickCopyRange"` + PasteCommits string `yaml:"pasteCommits"` + TagCommit string `yaml:"tagCommit"` + CheckoutCommit string `yaml:"checkoutCommit"` + ResetCherryPick string `yaml:"resetCherryPick"` + CopyCommitMessageToClipboard string `yaml:"copyCommitMessageToClipboard"` } type KeybindingStashConfig struct { @@ -390,24 +391,26 @@ func GetDefaultConfig() *UserConfig { SetUpstream: "u", FetchRemote: "f", }, - Commits: KeybindingCommitsConfig{SquashDown: "s", - RenameCommit: "r", - RenameCommitWithEditor: "R", - ViewResetOptions: "g", - MarkCommitAsFixup: "f", - CreateFixupCommit: "F", - SquashAboveCommits: "S", - MoveDownCommit: "<c-j>", - MoveUpCommit: "<c-k>", - AmendToCommit: "A", - PickCommit: "p", - RevertCommit: "t", - CherryPickCopy: "c", - CherryPickCopyRange: "C", - PasteCommits: "v", - TagCommit: "T", - CheckoutCommit: "<space>", - ResetCherryPick: "<c-R>", + Commits: KeybindingCommitsConfig{ + SquashDown: "s", + RenameCommit: "r", + RenameCommitWithEditor: "R", + ViewResetOptions: "g", + MarkCommitAsFixup: "f", + CreateFixupCommit: "F", + SquashAboveCommits: "S", + MoveDownCommit: "<c-j>", + MoveUpCommit: "<c-k>", + AmendToCommit: "A", + PickCommit: "p", + RevertCommit: "t", + CherryPickCopy: "c", + CherryPickCopyRange: "C", + PasteCommits: "v", + TagCommit: "T", + CheckoutCommit: "<space>", + ResetCherryPick: "<c-R>", + CopyCommitMessageToClipboard: "<c-y>", }, Stash: KeybindingStashConfig{ PopStash: "g", diff --git a/pkg/gui/commits_panel.go b/pkg/gui/commits_panel.go index 10932c1c8..36fa7bd44 100644 --- a/pkg/gui/commits_panel.go +++ b/pkg/gui/commits_panel.go @@ -591,3 +591,16 @@ func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) err return nil } + +func (gui *Gui) handleCopySelectedCommitMessageToClipboard() error { + commit := gui.getSelectedLocalCommit() + if commit == nil { + return nil + } + + message, err := gui.GitCommand.GetCommitMessage(commit.Sha) + if err != nil { + return gui.surfaceError(err) + } + return gui.OSCommand.CopyToClipboard(message) +} diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 2093bfca7..ba3e7a509 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -823,6 +823,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { }, { ViewName: "commits", + Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, + Key: gui.getKey(config.Commits.CopyCommitMessageToClipboard), + Handler: gui.wrappedHandler(gui.handleCopySelectedCommitMessageToClipboard), + Description: gui.Tr.LcCopyCommitMessageToClipboard, + }, + { + ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleViewReflogCommitFiles), diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index c1afe3bc3..296e3ddf4 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -371,6 +371,7 @@ func dutchTranslationSet() TranslationSet { LcOpenDiffingMenu: "open diff menu", LcShowingGitDiff: "laat output zien voor:", LcCopyCommitShaToClipboard: "copieer commit SHA naar clipboard", + LcCopyCommitMessageToClipboard: "copieer commit bericht naar clipboard", LcCopyBranchNameToClipboard: "copieer branch name naar clipboard", LcCopyFileNameToClipboard: "kopieer de bestandsnaam naar het klembord", LcCopyCommitFileNameToClipboard: "kopieer de vastgelegde bestandsnaam naar het klembord", diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 30548cc0d..2700246c2 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -381,6 +381,7 @@ type TranslationSet struct { LcOpenDiffingMenu string LcShowingGitDiff string LcCopyCommitShaToClipboard string + LcCopyCommitMessageToClipboard string LcCopyBranchNameToClipboard string LcCopyFileNameToClipboard string LcCopyCommitFileNameToClipboard string @@ -879,6 +880,7 @@ func englishTranslationSet() TranslationSet { LcOpenDiffingMenu: "open diff menu", LcShowingGitDiff: "showing output for:", LcCopyCommitShaToClipboard: "copy commit SHA to clipboard", + LcCopyCommitMessageToClipboard: "copy commit message to clipboard", LcCopyBranchNameToClipboard: "copy branch name to clipboard", LcCopyFileNameToClipboard: "copy the file name to the clipboard", LcCopyCommitFileNameToClipboard: "copy the committed file name to the clipboard", |