Skip to content

Commit db718a8

Browse files
committed
refactor: better winbar update
1 parent 16a155d commit db718a8

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

lua/doing.lua

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
local config = require("doing.config")
22
local state = require("doing.state")
3-
local utils = require("doing.utils")
43
local edit = require("doing.edit")
54

65
local Doing = {}
@@ -15,10 +14,8 @@ function Doing.setup(opts)
1514
if config.options.winbar.enabled then
1615
vim.api.nvim_create_autocmd({ "BufEnter", }, {
1716
callback = function()
18-
-- HACK: gives time to process filetype
19-
vim.defer_fn(function()
20-
utils.update_winbar()
21-
end, 100)
17+
vim.api.nvim_set_option_value("winbar", state.status(),
18+
{ scope = "local", })
2219
end,
2320
})
2421
end

lua/doing/utils.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ local config = require("doing.config")
22

33
local Utils = {}
44

5-
---redraw winbar depending on if there are tasks
6-
function Utils.update_winbar()
7-
if config.options.winbar.enabled then
8-
vim.api.nvim_set_option_value("winbar", require("doing").status(),
9-
{ scope = "local", })
10-
end
11-
end
12-
135
---checks whether the current window/buffer should display the plugin
146
function Utils.should_display()
157
-- once a window gets checked once, a variable is set to tell doing

0 commit comments

Comments
 (0)