diff --git a/rc/filetype/diff.kak b/rc/filetype/diff.kak index d904ce5a..c0cb4523 100644 --- a/rc/filetype/diff.kak +++ b/rc/filetype/diff.kak @@ -2,6 +2,12 @@ hook global BufCreate .*\.(diff|patch) %{ set-option buffer filetype diff } +hook global WinSetOption filetype=diff %{ + require-module diff +} + +provide-module diff %§ + add-highlighter shared/diff group add-highlighter shared/diff/ regex "^\+[^\n]*\n" 0:green,default add-highlighter shared/diff/ regex "^-[^\n]*\n" 0:red,default @@ -12,6 +18,8 @@ hook -group diff-highlight global WinSetOption filetype=diff %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/diff } } +§ + define-command \ -docstring %{diff-select-file: Select surrounding patch file} \ -params 0 \ diff --git a/rc/filetype/git.kak b/rc/filetype/git.kak index aa53de2d..52304582 100644 --- a/rc/filetype/git.kak +++ b/rc/filetype/git.kak @@ -35,6 +35,7 @@ hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{ provide-module git-commit %{ +require-module diff add-highlighter shared/git-commit regions add-highlighter shared/git-commit/diff region '^diff --git' '^(?=diff --git)' ref diff # highlight potential diffs from the -v option add-highlighter shared/git-commit/comments region ^# $ group diff --git a/rc/tools/git.kak b/rc/tools/git.kak index 0cd505d0..c79b620f 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -2,6 +2,7 @@ declare-option -docstring "name of the client in which documentation is to be di str docsclient hook -group git-log-highlight global WinSetOption filetype=git-log %{ + require-module diff add-highlighter window/git-log group 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 @@ -12,6 +13,7 @@ hook -group git-log-highlight global WinSetOption filetype=git-log %{ } hook -group git-status-highlight global WinSetOption filetype=git-status %{ + require-module diff add-highlighter window/git-status group add-highlighter window/git-status/ regex '^## ' 0:comment add-highlighter window/git-status/ regex '^## (\S*[^\s\.@])' 1:green