tools/git: add git grep using existing grep tool
This commit is contained in:
parent
be1a61a2ff
commit
01fd6552af
|
@ -66,9 +66,10 @@ define-command -params 1.. \
|
||||||
show-diff
|
show-diff
|
||||||
status
|
status
|
||||||
update-diff
|
update-diff
|
||||||
|
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\nrm\nreset\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-branch\nshow-diff\ninit\nstatus\nupdate-diff\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\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 ;;
|
||||||
|
@ -347,6 +348,15 @@ define-command -params 1.. \
|
||||||
reset|checkout)
|
reset|checkout)
|
||||||
run_git_cmd "$@"
|
run_git_cmd "$@"
|
||||||
;;
|
;;
|
||||||
|
grep)
|
||||||
|
shift
|
||||||
|
enquoted="$(printf '"%s" ' "$@")"
|
||||||
|
printf %s "try %{
|
||||||
|
set-option current grepcmd 'git grep -n'
|
||||||
|
grep $enquoted
|
||||||
|
set-option current grepcmd '$kak_opt_grepcmd'
|
||||||
|
}"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printf "fail unknown git command '%s'\n" "$1"
|
printf "fail unknown git command '%s'\n" "$1"
|
||||||
exit
|
exit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user