BufWritePost, what I'm missing?

Well… first of all sorry if a solution to my problem is quite obvious, but I can’t simply get my head around why this isn’t working. I’m still quite a noob when it comes to kakoune, so any help any help would be greatly appreciated.

hook global BufWritePost ~/.config/x11/xresources %{
    eval %sh{ xrdb "$kak_buffile" }

I haven’t tried it myself, but my first guess would be that the hook parameter for BufWritePost is an absolute path like /home/ugh/.config/... rather than ~/.config/.... You can check for yourself by making another BufWritePost hook with a .* regex, that just does echo -debug just wrote %val{hook_param} to log the contents of the hook parameter.

Indeed you were right! The filename in the BufWritePost hook is pattern matching with the buffile value. I just wonder if at somepoint there will be a way to hook to just the basename of a file, but that’s another topic I guess.

Well, the hook parameter is matched against a regex, so if you just want to match the basename of the file, you can do something like:

hook global BufWritePost .*/xresources %{
    # whatever

Ah of course! Thank you so much!