mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-25 18:55:28 -06: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'
|
tagCommit: 'T'
|
||||||
checkoutCommit: '<space>'
|
checkoutCommit: '<space>'
|
||||||
resetCherryPick: '<c-R>'
|
resetCherryPick: '<c-R>'
|
||||||
|
copyCommitMessageToClipboard: '<c-y>'
|
||||||
stash:
|
stash:
|
||||||
popStash: 'g'
|
popStash: 'g'
|
||||||
commitFiles:
|
commitFiles:
|
||||||
|
|||||||
@@ -180,24 +180,25 @@ type KeybindingBranchesConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingCommitsConfig struct {
|
type KeybindingCommitsConfig struct {
|
||||||
SquashDown string `yaml:"squashDown"`
|
SquashDown string `yaml:"squashDown"`
|
||||||
RenameCommit string `yaml:"renameCommit"`
|
RenameCommit string `yaml:"renameCommit"`
|
||||||
RenameCommitWithEditor string `yaml:"renameCommitWithEditor"`
|
RenameCommitWithEditor string `yaml:"renameCommitWithEditor"`
|
||||||
ViewResetOptions string `yaml:"viewResetOptions"`
|
ViewResetOptions string `yaml:"viewResetOptions"`
|
||||||
MarkCommitAsFixup string `yaml:"markCommitAsFixup"`
|
MarkCommitAsFixup string `yaml:"markCommitAsFixup"`
|
||||||
CreateFixupCommit string `yaml:"createFixupCommit"`
|
CreateFixupCommit string `yaml:"createFixupCommit"`
|
||||||
SquashAboveCommits string `yaml:"squashAboveCommits"`
|
SquashAboveCommits string `yaml:"squashAboveCommits"`
|
||||||
MoveDownCommit string `yaml:"moveDownCommit"`
|
MoveDownCommit string `yaml:"moveDownCommit"`
|
||||||
MoveUpCommit string `yaml:"moveUpCommit"`
|
MoveUpCommit string `yaml:"moveUpCommit"`
|
||||||
AmendToCommit string `yaml:"amendToCommit"`
|
AmendToCommit string `yaml:"amendToCommit"`
|
||||||
PickCommit string `yaml:"pickCommit"`
|
PickCommit string `yaml:"pickCommit"`
|
||||||
RevertCommit string `yaml:"revertCommit"`
|
RevertCommit string `yaml:"revertCommit"`
|
||||||
CherryPickCopy string `yaml:"cherryPickCopy"`
|
CherryPickCopy string `yaml:"cherryPickCopy"`
|
||||||
CherryPickCopyRange string `yaml:"cherryPickCopyRange"`
|
CherryPickCopyRange string `yaml:"cherryPickCopyRange"`
|
||||||
PasteCommits string `yaml:"pasteCommits"`
|
PasteCommits string `yaml:"pasteCommits"`
|
||||||
TagCommit string `yaml:"tagCommit"`
|
TagCommit string `yaml:"tagCommit"`
|
||||||
CheckoutCommit string `yaml:"checkoutCommit"`
|
CheckoutCommit string `yaml:"checkoutCommit"`
|
||||||
ResetCherryPick string `yaml:"resetCherryPick"`
|
ResetCherryPick string `yaml:"resetCherryPick"`
|
||||||
|
CopyCommitMessageToClipboard string `yaml:"copyCommitMessageToClipboard"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingStashConfig struct {
|
type KeybindingStashConfig struct {
|
||||||
@@ -390,24 +391,26 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
SetUpstream: "u",
|
SetUpstream: "u",
|
||||||
FetchRemote: "f",
|
FetchRemote: "f",
|
||||||
},
|
},
|
||||||
Commits: KeybindingCommitsConfig{SquashDown: "s",
|
Commits: KeybindingCommitsConfig{
|
||||||
RenameCommit: "r",
|
SquashDown: "s",
|
||||||
RenameCommitWithEditor: "R",
|
RenameCommit: "r",
|
||||||
ViewResetOptions: "g",
|
RenameCommitWithEditor: "R",
|
||||||
MarkCommitAsFixup: "f",
|
ViewResetOptions: "g",
|
||||||
CreateFixupCommit: "F",
|
MarkCommitAsFixup: "f",
|
||||||
SquashAboveCommits: "S",
|
CreateFixupCommit: "F",
|
||||||
MoveDownCommit: "<c-j>",
|
SquashAboveCommits: "S",
|
||||||
MoveUpCommit: "<c-k>",
|
MoveDownCommit: "<c-j>",
|
||||||
AmendToCommit: "A",
|
MoveUpCommit: "<c-k>",
|
||||||
PickCommit: "p",
|
AmendToCommit: "A",
|
||||||
RevertCommit: "t",
|
PickCommit: "p",
|
||||||
CherryPickCopy: "c",
|
RevertCommit: "t",
|
||||||
CherryPickCopyRange: "C",
|
CherryPickCopy: "c",
|
||||||
PasteCommits: "v",
|
CherryPickCopyRange: "C",
|
||||||
TagCommit: "T",
|
PasteCommits: "v",
|
||||||
CheckoutCommit: "<space>",
|
TagCommit: "T",
|
||||||
ResetCherryPick: "<c-R>",
|
CheckoutCommit: "<space>",
|
||||||
|
ResetCherryPick: "<c-R>",
|
||||||
|
CopyCommitMessageToClipboard: "<c-y>",
|
||||||
},
|
},
|
||||||
Stash: KeybindingStashConfig{
|
Stash: KeybindingStashConfig{
|
||||||
PopStash: "g",
|
PopStash: "g",
|
||||||
|
|||||||
@@ -591,3 +591,16 @@ func (gui *Gui) handleGotoBottomForCommitsPanel(g *gocui.Gui, v *gocui.View) err
|
|||||||
|
|
||||||
return nil
|
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),
|
Handler: gui.wrappedHandler(gui.exitCherryPickingMode),
|
||||||
Description: gui.Tr.LcResetCherryPick,
|
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",
|
ViewName: "commits",
|
||||||
Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY},
|
Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY},
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ func dutchTranslationSet() TranslationSet {
|
|||||||
LcOpenDiffingMenu: "open diff menu",
|
LcOpenDiffingMenu: "open diff menu",
|
||||||
LcShowingGitDiff: "laat output zien voor:",
|
LcShowingGitDiff: "laat output zien voor:",
|
||||||
LcCopyCommitShaToClipboard: "copieer commit SHA naar clipboard",
|
LcCopyCommitShaToClipboard: "copieer commit SHA naar clipboard",
|
||||||
|
LcCopyCommitMessageToClipboard: "copieer commit bericht naar clipboard",
|
||||||
LcCopyBranchNameToClipboard: "copieer branch name naar clipboard",
|
LcCopyBranchNameToClipboard: "copieer branch name naar clipboard",
|
||||||
LcCopyFileNameToClipboard: "kopieer de bestandsnaam naar het klembord",
|
LcCopyFileNameToClipboard: "kopieer de bestandsnaam naar het klembord",
|
||||||
LcCopyCommitFileNameToClipboard: "kopieer de vastgelegde bestandsnaam naar het klembord",
|
LcCopyCommitFileNameToClipboard: "kopieer de vastgelegde bestandsnaam naar het klembord",
|
||||||
|
|||||||
@@ -381,6 +381,7 @@ type TranslationSet struct {
|
|||||||
LcOpenDiffingMenu string
|
LcOpenDiffingMenu string
|
||||||
LcShowingGitDiff string
|
LcShowingGitDiff string
|
||||||
LcCopyCommitShaToClipboard string
|
LcCopyCommitShaToClipboard string
|
||||||
|
LcCopyCommitMessageToClipboard string
|
||||||
LcCopyBranchNameToClipboard string
|
LcCopyBranchNameToClipboard string
|
||||||
LcCopyFileNameToClipboard string
|
LcCopyFileNameToClipboard string
|
||||||
LcCopyCommitFileNameToClipboard string
|
LcCopyCommitFileNameToClipboard string
|
||||||
@@ -879,6 +880,7 @@ func englishTranslationSet() TranslationSet {
|
|||||||
LcOpenDiffingMenu: "open diff menu",
|
LcOpenDiffingMenu: "open diff menu",
|
||||||
LcShowingGitDiff: "showing output for:",
|
LcShowingGitDiff: "showing output for:",
|
||||||
LcCopyCommitShaToClipboard: "copy commit SHA to clipboard",
|
LcCopyCommitShaToClipboard: "copy commit SHA to clipboard",
|
||||||
|
LcCopyCommitMessageToClipboard: "copy commit message to clipboard",
|
||||||
LcCopyBranchNameToClipboard: "copy branch name to clipboard",
|
LcCopyBranchNameToClipboard: "copy branch name to clipboard",
|
||||||
LcCopyFileNameToClipboard: "copy the file name to the clipboard",
|
LcCopyFileNameToClipboard: "copy the file name to the clipboard",
|
||||||
LcCopyCommitFileNameToClipboard: "copy the committed file name to the clipboard",
|
LcCopyCommitFileNameToClipboard: "copy the committed file name to the clipboard",
|
||||||
|
|||||||
Reference in New Issue
Block a user