summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-05-18 19:15:23 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-08-21 10:03:34 +0200
commit61bd3e8dd2d00db3259ddc4f930770127b6de3d0 (patch)
treee85719367b1b01b20c7368e562a45f22191b3d56 /pkg/commands
parent726363096778dc95d7cf7c5d1e88824efc23929f (diff)
Add key binding for switching from the commit message panel to an editor
This is useful for when you begin to type the message in lazygit's commit panel, and then realize that you'd rather use your editor's more powerful editing capabilities. Pressing <c-o> will take you right there.
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/commit.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/commands/git_commands/commit.go b/pkg/commands/git_commands/commit.go
index 16702f9be..ec27d66cb 100644
--- a/pkg/commands/git_commands/commit.go
+++ b/pkg/commands/git_commands/commit.go
@@ -68,6 +68,19 @@ func (self *CommitCommands) RewordLastCommitInEditorCmdObj() oscommands.ICmdObj
return self.cmd.New(NewGitCmd("commit").Arg("--allow-empty", "--amend", "--only").ToArgv())
}
+func (self *CommitCommands) RewordLastCommitInEditorWithMessageFileCmdObj(tmpMessageFile string) oscommands.ICmdObj {
+ return self.cmd.New(NewGitCmd("commit").
+ Arg("--allow-empty", "--amend", "--only", "--edit", "--file="+tmpMessageFile).ToArgv())
+}
+
+func (self *CommitCommands) CommitInEditorWithMessageFileCmdObj(tmpMessageFile string) oscommands.ICmdObj {
+ return self.cmd.New(NewGitCmd("commit").
+ Arg("--edit").
+ Arg("--file="+tmpMessageFile).
+ ArgIf(self.signoffFlag() != "", self.signoffFlag()).
+ ToArgv())
+}
+
// RewordLastCommit rewords the topmost commit with the given message
func (self *CommitCommands) RewordLastCommit(summary string, description string) error {
messageArgs := self.commitMessageArgs(summary, description)