From 766b050d84485fe4acc9254631db16bec6083bb3 Mon Sep 17 00:00:00 2001 From: Gregory Chamberlain Date: Wed, 29 Jan 2020 11:58:18 +0000 Subject: [PATCH 1/4] Gregory Chamberlain Copyright Waiver I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. From eb1b629829d8a1de8636d505109b71af5fe441ac Mon Sep 17 00:00:00 2001 From: Gregory Chamberlain Date: Wed, 29 Jan 2020 12:48:08 +0000 Subject: [PATCH 2/4] rc git: Improve git-log highlighters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds support for highlighting git-log(1) output with the ‘--graph’ and ‘--pretty=oneline’ options. --- rc/tools/git.kak | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index ccf6cfa0a..e938e555c 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -3,8 +3,9 @@ declare-option -docstring "name of the client in which documentation is to be di hook -group git-log-highlight global WinSetOption filetype=git-log %{ add-highlighter window/git-log group - add-highlighter window/git-log/ regex '^(commit) ([0-9a-f]+)( [^\n]+)?$' 1:keyword 2:meta 3:comment - add-highlighter window/git-log/ regex '^([a-zA-Z_-]+:) (.*?)$' 1:variable 2:value + add-highlighter window/git-log/ regex '^([\*|\\ /_])*' 0:keyword + add-highlighter window/git-log/ regex '^( ?[\*|\\/_])*\h{,3}(commit )?(\b[0-9a-f]{4,40}\b)' 2:keyword 3:comment + add-highlighter window/git-log/ regex '^( ?[\*|\\/_])*\h{,3}([a-zA-Z_-]+:) (.*?)$' 2:variable 3:value add-highlighter window/git-log/ ref diff # highlight potential diffs from the -p option hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-log } From f4e85859811c0db1fff121bbbc629403b9d79dcb Mon Sep 17 00:00:00 2001 From: Gregory Chamberlain Date: Wed, 29 Jan 2020 17:19:23 +0000 Subject: [PATCH 3/4] rc git: Expand highlighting of git status Adds support for highlighting git-status(1) output in short format (--short) and with branch name (--branch), including file renames and commits ahead/behind information. --- rc/tools/git.kak | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index e938e555c..556b09ca7 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -13,6 +13,15 @@ hook -group git-log-highlight global WinSetOption filetype=git-log %{ hook -group git-status-highlight global WinSetOption filetype=git-status %{ add-highlighter window/git-status group + add-highlighter window/git-status/ regex '^## ' 0:comment + add-highlighter window/git-status/ regex '^## (\S*[^\s\.@])' 1:green + add-highlighter window/git-status/ regex '^## (\S*[^\s\.@])(\.\.+)(\S*[^\s\.@])' 1:green 2:comment 3:red + add-highlighter window/git-status/ regex '^(##) (No commits yet on) (\S*[^\s\.@])' 1:comment 2:Default 3:green + add-highlighter window/git-status/ regex '^## \S+ \[[^\n]*ahead (\d+)[^\n]*\]' 1:green + add-highlighter window/git-status/ regex '^## \S+ \[[^\n]*behind (\d+)[^\n]*\]' 1:red + add-highlighter window/git-status/ regex '^(?:([Aa])|([Cc])|([Dd!?])|([MUmu])|([Rr])|([Tt]))[ !\?ACDMRTUacdmrtu]\h' 1:green 2:blue 3:red 4:yellow 5:cyan 6:cyan + add-highlighter window/git-status/ regex '^[ !\?ACDMRTUacdmrtu](?:([Aa])|([Cc])|([Dd!?])|([MUmu])|([Rr])|([Tt]))\h' 1:green 2:blue 3:red 4:yellow 5:cyan 6:cyan + add-highlighter window/git-status/ regex '^R[ !\?ACDMRTUacdmrtu] [^\n]+( -> )' 1:cyan add-highlighter window/git-status/ regex '^\h+(?:((?:both )?modified:)|(added:|new file:)|(deleted(?: by \w+)?:)|(renamed:)|(copied:))(?:.*?)$' 1:yellow 2:green 3:red 4:cyan 5:blue 6:magenta hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-status } From 548c6b0b7e810071f6f8b03117f7cb825c3dc805 Mon Sep 17 00:00:00 2001 From: Gregory Chamberlain Date: Sun, 2 Feb 2020 00:24:43 +0000 Subject: [PATCH 4/4] =?UTF-8?q?rc=20git:=20Use=20git-log=20filetype=20for?= =?UTF-8?q?=20=E2=80=98:git=20show=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The git-log filetype is more appropriate for ‘git show’ output because it highlights both diffs and commit data. --- rc/tools/git.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/tools/git.kak b/rc/tools/git.kak index 556b09ca7..bd2c39fd2 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -58,8 +58,8 @@ Available commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide- show_git_cmd_output() { local filetype case "$1" in - show|diff) filetype=diff ;; - log) filetype=git-log ;; + diff) filetype=diff ;; + log|show) filetype=git-log ;; status) filetype=git-status ;; esac output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-git.XXXXXXXX)/fifo