From 904cec3c4a329cf89fc3219d359239910d61f3f6 Mon Sep 17 00:00:00 2001 From: thing1 Date: Tue, 28 Jan 2025 09:14:32 +0000 Subject: init commit --- autoload/filetype/git.kak | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 autoload/filetype/git.kak (limited to 'autoload/filetype/git.kak') diff --git a/autoload/filetype/git.kak b/autoload/filetype/git.kak new file mode 100644 index 0000000..4501162 --- /dev/null +++ b/autoload/filetype/git.kak @@ -0,0 +1,69 @@ +hook global BufCreate .*(COMMIT_EDITMSG|MERGE_MSG) %{ + set-option buffer filetype git-commit +} + +hook global BufCreate .*/NOTES_EDITMSG %{ + set-option buffer filetype git-notes +} + +hook global BufCreate .*(\.git(config|modules)|git/config) %{ + set-option buffer filetype ini +} + +hook global BufCreate .*\.gitignore %{ + set-option buffer filetype git-ignore +} + +hook global BufCreate .*git-rebase-todo %{ + set-option buffer filetype git-rebase +} + +hook global WinSetOption filetype=git-(commit|ignore|notes|rebase) %{ + require-module "git-%val{hook_param_capture_1}" +} + +hook -group git-commit-highlight global WinSetOption filetype=git-commit %{ + add-highlighter window/git-commit ref git-commit + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-commit } +} + +hook -group git-ignore-highlight global WinSetOption filetype=git-ignore %{ + add-highlighter window/git-ignore ref git-ignore + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-ignore } +} + +hook -group git-notes-highlight global WinSetOption filetype=git-notes %{ + add-highlighter window/git-notes ref git-notes + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-notes } +} + +hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{ + add-highlighter window/git-rebase ref git-rebase + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/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 +add-highlighter shared/git-commit/comments/ fill comment +add-highlighter shared/git-commit/comments/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)$" 1:yellow 2:red 3:green 4:blue 5:magenta +} + +provide-module git-ignore %{ +add-highlighter shared/git-ignore group +add-highlighter shared/git-ignore/glob regex '(?