From b29ae2dcb97648c2cef6c37afb704a5c99744f42 Mon Sep 17 00:00:00 2001 From: Kirk Easterson Date: Thu, 12 Sep 2024 10:51:53 +0200 Subject: [PATCH] feat(nvim): use formatter for blame message --- .../nvim/lua/kirk/plugins/git/gitsigns.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nvim/.config/nvim/lua/kirk/plugins/git/gitsigns.lua b/nvim/.config/nvim/lua/kirk/plugins/git/gitsigns.lua index 8b5baf17..2711d8e5 100644 --- a/nvim/.config/nvim/lua/kirk/plugins/git/gitsigns.lua +++ b/nvim/.config/nvim/lua/kirk/plugins/git/gitsigns.lua @@ -49,9 +49,22 @@ return { untracked = { text = "┃" }, }, current_line_blame = false, - current_line_blame_formatter = "  ", current_line_blame_opts = { delay = 10, }, + current_line_blame_formatter = function(name, blame_info) + if blame_info.author == name then + blame_info.author = "You" + end + + local message = string.format( + "%s  %s  %s", + blame_info.author, + os.date("%Y-%b-%d", blame_info.author_time), + blame_info.summary + ) + + return { { "  " .. message, "GitSignsCurrentLineBlame" } } + end, }, }