diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-11 16:55:39 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-11 16:55:39 +1000 |
commit | 1419be1aabc80bac9d95c789b739fb8a028c4d82 (patch) | |
tree | cc0c0ce4fd86f581d0f403f53f8e1f3edb2a5e19 | |
parent | 0ac306fe2afaa1e75d8dde2c2d11bf34659551bc (diff) |
support commit message via git editor using shift+C keybinding
-rw-r--r-- | docs/Keybindings.md | 2 | ||||
-rw-r--r-- | files_panel.go | 8 | ||||
-rw-r--r-- | keybindings.go | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/docs/Keybindings.md b/docs/Keybindings.md index c46960676..46f147201 100644 --- a/docs/Keybindings.md +++ b/docs/Keybindings.md @@ -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): diff --git a/files_panel.go b/files_panel.go index 2d7406c45..4de8caca7 100644 --- a/files_panel.go +++ b/files_panel.go @@ -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 { diff --git a/keybindings.go b/keybindings.go index 2eab3aab5..afaa09527 100644 --- a/keybindings.go +++ b/keybindings.go @@ -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}, |