From 83b7bbdc55059134af4b0e3e5c0fe68d3930fee8 Mon Sep 17 00:00:00 2001 From: Loric Brevet Date: Fri, 3 Nov 2023 16:27:00 +0100 Subject: [PATCH] rc/tools/git: edit a git indexed file with git edit --- rc/tools/git.kak | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index 8b26cd4c..1e84c811 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -69,12 +69,13 @@ define-command -params 1.. \ grep } -shell-script-candidates %{ if [ $kak_token_to_complete -eq 0 ]; then - printf "add\nrm\nreset\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-branch\nshow-diff\ninit\nstatus\nupdate-diff\ngrep\n" + printf "add\nrm\nreset\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-branch\nshow-diff\ninit\nstatus\nupdate-diff\ngrep\nedit\n" else case "$1" in commit) printf -- "--amend\n--no-edit\n--all\n--reset-author\n--fixup\n--squash\n"; git ls-files -m ;; add) git ls-files -dmo --exclude-standard ;; - rm|grep) git ls-files -c ;; + rm) git ls-files -c ;; + grep|edit) git ls-files -c --recurse-submodules ;; esac fi } \ @@ -357,6 +358,11 @@ define-command -params 1.. \ set-option current grepcmd '$kak_opt_grepcmd' }" ;; + edit) + shift + enquoted="$(printf '"%s" ' "$@")" + printf %s "edit -existing -- $enquoted" + ;; *) printf "fail unknown git command '%s'\n" "$1" exit