From 0b29fcf32ac756dc54ec5c52db63340c9b3692e9 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 1 Feb 2022 20:09:48 +0100 Subject: [PATCH] rc diff: evaluate diff-highlight hook before loading module A recent commit wrapped diff.kak into a module. The module includes the hook that adds diff highlighting to filetype=diff buffers. This means that the hook is only loaded after opening the first diff buffer in a Kakoune session, so it only actually fires for the second diff buffer. Fix this by moving the hook out of the module. Fixes #4525 --- rc/filetype/diff.kak | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rc/filetype/diff.kak b/rc/filetype/diff.kak index 6658bab0..b4c550a6 100644 --- a/rc/filetype/diff.kak +++ b/rc/filetype/diff.kak @@ -7,6 +7,11 @@ hook global WinSetOption filetype=diff %{ require-module diff } +hook -group diff-highlight global WinSetOption filetype=diff %{ + add-highlighter window/diff ref diff + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/diff } +} + provide-module diff %ยง add-highlighter shared/diff group @@ -14,11 +19,6 @@ add-highlighter shared/diff/ regex "^\+[^\n]*\n" 0:green,default add-highlighter shared/diff/ regex "^-[^\n]*\n" 0:red,default add-highlighter shared/diff/ regex "^@@[^\n]*@@" 0:cyan,default -hook -group diff-highlight global WinSetOption filetype=diff %{ - add-highlighter window/diff ref diff - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/diff } -} - define-command diff-jump \ -docstring %{diff-jump [] []: edit the diff's source file at the cursor position. Paths are resolved relative to , or the current working directory if unspecified.