From 39f5e9f4958a044a9b4876ead1e946f2a54be141 Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Sat, 8 Jun 2024 00:47:23 +0200 Subject: [PATCH] barbar: make minor refinements to api calls --- lua/nxvim/plugins/barbar.lua | 2 +- lua/nxvim/plugins/neo-tree.lua | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lua/nxvim/plugins/barbar.lua b/lua/nxvim/plugins/barbar.lua index 0708144..a18d030 100644 --- a/lua/nxvim/plugins/barbar.lua +++ b/lua/nxvim/plugins/barbar.lua @@ -48,7 +48,7 @@ nx.au({ "FileType", pattern = { "NeogitStatus", "DiffviewFiles" }, callback = function() - vim.defer_fn(function() barbar_api.set_offset(0) end, 75) + vim.defer_fn(function() barbar_api.set_offset(0) end, 100) end, }) -- <== } diff --git a/lua/nxvim/plugins/neo-tree.lua b/lua/nxvim/plugins/neo-tree.lua index 92d27a5..6e0ad1e 100644 --- a/lua/nxvim/plugins/neo-tree.lua +++ b/lua/nxvim/plugins/neo-tree.lua @@ -171,7 +171,7 @@ local function set_offset() if not barbar_ok then return end local title = " 󰙅 " .. utils.truc_path(vim.fn.getcwd()) local space = neo_tree_win.width - title:len() - local filler = space > 0 and (" "):rep(neo_tree_win.width - title:len()) or "" + local filler = space > 0 and (" "):rep(space) or " " barbar_api.set_offset(neo_tree_win.width + 2, title .. filler .. spacer) end @@ -186,17 +186,12 @@ config.event_handlers = { neo_tree_win.width = vim.api.nvim_win_get_width(args.winid) end, }, - { - event = "neo_tree_window_before_close", - handler = function() - if barbar_ok then barbar_api.set_offset(0) end - end, - }, { event = "neo_tree_window_after_close", handler = function() if require("nxvim.plugins.windows").auto_maximize then vim.cmd("WindowsMaximize") end neo_tree_win.id = -1 + if barbar_ok then barbar_api.set_offset(0) end end, }, }