rc diff: make it a module
We want to move git-diff-goto-source from rc/tools/git.kak to rc/filetype/diff.kak (or should we could create rc/tools/diff.kak?). Either way, create the diff module so we can formalize this dependency. Currently this module only provides highlighters, so require it wherever we reference them. Keep the diff-select-{file,hunk} commands outside the module because people might already use them in git buffers.
This commit is contained in:
parent
9acd4e62dc
commit
b84abd57de
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user