From 3eeebd676a527d0d786d3660e3b0e9ca42c33cea Mon Sep 17 00:00:00 2001 From: nonumeros Date: Fri, 17 Jun 2022 03:08:46 -0400 Subject: [PATCH] git-show-branch added to show graph with branches and commits --- rc/tools/git.kak | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index e65374c6..d361a6c7 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -29,6 +29,16 @@ hook -group git-status-highlight global WinSetOption filetype=git-status %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-status } } +hook -group git-show-branch-highlight global WinSetOption filetype=git-show-branch %{ + require-module diff + add-highlighter window/git-show-branch group + add-highlighter window/git-show-branch/ regex '(\*)|(\+)|(!)' 1:red 2:green 3:green + add-highlighter window/git-show-branch/ regex '(!\D+\{0\}\])|(!\D+\{1\}\])|(!\D+\{2\}\])|(!\D+\{3\}\])' 1:red 2:green 3:yellow 4:blue + add-highlighter window/git-show-branch/ regex '(\B\+\D+\{0\}\])|(\B\+\D+\{1\}\])|(\B\+\D+\{2\}\])|(\B\+\D+\{3\}\])|(\B\+\D+\{1\}\^\])' 1:red 2:green 3:yellow 4:blue 5:magenta + + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-show-branch} +} + declare-option -hidden line-specs git_blame_flags declare-option -hidden line-specs git_diff_flags declare-option -hidden int-list git_hunk_list @@ -51,12 +61,13 @@ define-command -params 1.. \ next-hunk previous-hunk show + show-branch show-diff status update-diff } -shell-script-candidates %{ if [ $kak_token_to_complete -eq 0 ]; then - printf "add\nrm\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-diff\ninit\nstatus\nupdate-diff\n" + printf "add\nrm\nblame\ncommit\ncheckout\ndiff\nhide-blame\nhide-diff\nlog\nnext-hunk\nprev-hunk\nshow\nshow-branch\nshow-diff\ninit\nstatus\nupdate-diff\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 ;; @@ -81,6 +92,7 @@ define-command -params 1.. \ case "$1" in diff) map_diff_goto_source=true; filetype=diff ;; show) map_diff_goto_source=true; filetype=git-log ;; + show-branch) filetype=git-show-branch ;; log) filetype=git-log ;; status) filetype=git-status ;; *) return 1 ;; @@ -299,7 +311,7 @@ define-command -params 1.. \ } case "$1" in - show|log|diff|status) + show|show-branch|log|diff|status) show_git_cmd_output "$@" ;; blame)