1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-11-26 09:00:57 +02:00

support commit message via git editor using shift+C keybinding

This commit is contained in:
Jesse Duffield 2018-08-11 16:55:39 +10:00
parent 0ac306fe2a
commit 1419be1aab
3 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@
space: toggle staged
c: commit changes
shift+C: commit using git editor
shift+S: stash files
t: add patched (i.e. pick chunks of a file to add)
o: open
@ -47,6 +48,7 @@
esc: close/cancel
enter: confirm
tab: enter newline (if editing)
## Resolving Merge Conflicts (Diff Panel):

View File

@ -186,6 +186,14 @@ func handleCommitPress(g *gocui.Gui, filesView *gocui.View) error {
return nil
}
func handleCommitEditorPress(g *gocui.Gui, filesView *gocui.View) error {
if len(stagedFiles(state.GitFiles)) == 0 && !state.HasMergeConflicts {
return createErrorPanel(g, "There are no staged files to commit")
}
runSubProcess(g, "git", "commit")
return nil
}
func genericFileOpen(g *gocui.Gui, v *gocui.View, open func(*gocui.Gui, string) (string, error)) error {
file, err := getSelectedFile(g)
if err != nil {

View File

@ -22,6 +22,7 @@ func keybindings(g *gocui.Gui) error {
{ViewName: "", Key: 'p', Modifier: gocui.ModNone, Handler: pullFiles},
{ViewName: "", Key: 'R', Modifier: gocui.ModNone, Handler: handleRefresh},
{ViewName: "files", Key: 'c', Modifier: gocui.ModNone, Handler: handleCommitPress},
{ViewName: "files", Key: 'C', Modifier: gocui.ModNone, Handler: handleCommitEditorPress},
{ViewName: "files", Key: gocui.KeySpace, Modifier: gocui.ModNone, Handler: handleFilePress},
{ViewName: "files", Key: 'd', Modifier: gocui.ModNone, Handler: handleFileRemove},
{ViewName: "files", Key: 'm', Modifier: gocui.ModNone, Handler: handleSwitchToMerge},