From fef97d4439c6b4038d585415eb2712caef5b2dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ot=C3=A1vio=20Schwanck=20dos=20Santos?= Date: Thu, 18 May 2023 18:15:03 +0100 Subject: [PATCH] feat: redraw tabline --- lua/harpoon/mark.lua | 9 ++++++++- lua/harpoon/tabline.lua | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lua/harpoon/mark.lua b/lua/harpoon/mark.lua index 3f498d7..7b2465b 100644 --- a/lua/harpoon/mark.lua +++ b/lua/harpoon/mark.lua @@ -11,10 +11,17 @@ local callbacks = {} -- need one event emitted local function emit_changed() log.trace("_emit_changed()") - if harpoon.get_global_settings().save_on_change then + + local global_settings = harpoon.get_global_settings() + + if global_settings.save_on_change then harpoon.save() end + if global_settings.tabline then + vim.cmd("redrawt") + end + if not callbacks["changed"] then log.trace("_emit_changed(): no callbacks for 'changed', returning") return diff --git a/lua/harpoon/tabline.lua b/lua/harpoon/tabline.lua index 2030c27..3013250 100644 --- a/lua/harpoon/tabline.lua +++ b/lua/harpoon/tabline.lua @@ -39,7 +39,14 @@ function M.setup(opts) for i, tab in ipairs(original_tabs) do local is_current = string.match(vim.fn.bufname(), tab.filename) or vim.fn.bufname() == tab.filename - local label = tabs[i].filename + local label + + if tabs[i].filename == "" or tabs[i].filename == "(empty)" then + label = "(empty)" + is_current = false + else + label = tabs[i].filename + end if is_current then