Merge remote-tracking branch 'lobre/git-edit'

This commit is contained in:
Maxime Coste 2023-11-05 11:12:43 +11:00
commit 1da8952e1f

View File

@ -82,13 +82,13 @@ define-command -params 1.. \
grep grep
} -shell-script-candidates %{ } -shell-script-candidates %{
if [ $kak_token_to_complete -eq 0 ]; then if [ $kak_token_to_complete -eq 0 ]; then
printf "add\napply\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\napply\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 else
case "$1" in case "$1" in
commit) printf -- "--amend\n--no-edit\n--all\n--reset-author\n--fixup\n--squash\n"; git ls-files -m ;; 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 ;; add) git ls-files -dmo --exclude-standard ;;
apply) printf -- "--reverse\n--cached\n--index\n" ;; apply) printf -- "--reverse\n--cached\n--index\n" ;;
rm|grep) git ls-files -c ;; grep|edit) git ls-files -c --recurse-submodules ;;
esac esac
fi fi
} \ } \
@ -382,6 +382,11 @@ define-command -params 1.. \
set-option current grepcmd '$kak_opt_grepcmd' 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" printf "fail unknown git command '%s'\n" "$1"
exit exit