1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-08-16 16:20:38 +03:00

rc tools git: detect filetype=git-diff for untracked diff buffers

On untracked diff buffers, it might be useful to make the upcoming
blame features work.

This is experimental, I might drop it.
This commit is contained in:
Johannes Altmanninger 2024-02-03 00:26:54 +01:00 committed by Maxime Coste
parent d6b75ac0bb
commit ce7ceb1cf0

View File

@ -21,6 +21,18 @@ hook -group git-log-highlight global WinSetOption filetype=git-log %{
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-log }
}
hook global WinSetOption filetype=diff %{
try %{
execute-keys -draft %{/^diff --git\b<ret>}
evaluate-commands %sh{
if [ -n "$(git ls-files -- "${kak_buffile}")" ]; then
echo fail
fi
}
set-option buffer filetype git-diff
}
}
hook -group git-diff-highlight global WinSetOption filetype=(git-diff|git-log) %{
require-module diff
add-highlighter %exp{window/%val{hook_param_capture_1}-ref-diff} ref diff