mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-06 08:59:31 +02:00
Copy a commit message to clipboard: Changes to latest version
This commit is contained in:
committed by
Jesse Duffield
parent
031e97ef91
commit
1ff405edd8
@@ -156,6 +156,7 @@ Default path for the config file:
|
||||
tagCommit: 'T'
|
||||
checkoutCommit: '<space>'
|
||||
resetCherryPick: '<c-R>'
|
||||
copyCommitMessageToClipboard: '<c-y>'
|
||||
stash:
|
||||
popStash: 'g'
|
||||
commitFiles:
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -821,6 +821,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||
Handler: gui.wrappedHandler(gui.exitCherryPickingMode),
|
||||
Description: gui.Tr.LcResetCherryPick,
|
||||
},
|
||||
{
|
||||
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},
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user