summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Chamberlain <chambln@protonmail.com>2020-01-29 17:19:23 +0000
committerGregory Chamberlain <chambln@protonmail.com>2020-01-29 17:19:23 +0000
commitf4e85859811c0db1fff121bbbc629403b9d79dcb (patch)
tree6c6c119ad74fb51e624e72aabae86ff72c503bad
parenteb1b629829d8a1de8636d505109b71af5fe441ac (diff)
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.
-rw-r--r--rc/tools/git.kak9
1 files changed, 9 insertions, 0 deletions
diff --git a/rc/tools/git.kak b/rc/tools/git.kak
index e938e555..556b09ca 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 }