Compare commits

..

No commits in common. "34a78e941d32483f66783f77f39f6528fb2dfb12" and "9e341ec60b5cb47a712b634babaa938b3c3828f2" have entirely different histories.

2 changed files with 30 additions and 55 deletions

View File

@ -39,7 +39,7 @@ M.setup = function()
opt.wrap = true opt.wrap = true
opt.breakat = " \t;,[]()" opt.breakat = " \t;,[]()"
opt.linebreak = true opt.linebreak = true
opt.formatlistpat = [[^\s*\(-\|\d\.\|+\)\s*]] opt.formatlistpat = [[^\s*\(-\|\d\.\)\s*]]
opt.breakindent = true opt.breakindent = true
opt.breakindentopt = "list:2" opt.breakindentopt = "list:2"

View File

@ -618,25 +618,20 @@ return {
} }
vim.opt.showcmdloc = "statusline" vim.opt.showcmdloc = "statusline"
local timer = vim.uv.new_timer()
timer:start(
1000,
500,
vim.schedule_wrap(function()
vim.api.nvim_exec_autocmds("User", { pattern = "HeirlineOrgUpdate" })
end)
)
local org = require("orgmode") local org = require("orgmode")
local OrgDate = require("orgmode.objects.date")
local Orgmode = { local Orgmode = {
condition = function() condition = function()
return org.initialized return org.initialized and org.clock.clocked_headline and org.clock.clocked_headline:is_clocked_in()
end,
update = function(self)
local time = os.time()
self.last_updated = self.last_updated or time
if time - self.last_updated >= 1 then
self.last_updated = time
return true
end
end, end,
update = {
"User",
pattern = "HeirlineOrgUpdate",
},
margin(1), margin(1),
{ {
provider = seps.full.left, provider = seps.full.left,
@ -665,7 +660,6 @@ return {
bg = colors.sumiInk4, bg = colors.sumiInk4,
}, },
provider = function() provider = function()
local clocked_in_task = function()
local headline = org.clock.clocked_headline local headline = org.clock.clocked_headline
if not headline then if not headline then
return return
@ -688,25 +682,6 @@ return {
message = message:sub(1, 65) .. "" message = message:sub(1, 65) .. ""
end end
return message return message
end
local remaining_tasks_today = function()
local remaining_tasks_today = 0
local today = OrgDate:today()
for _, orgfile in pairs(org.files.files) do
---@type OrgFile
orgfile = orgfile
for _, headline in ipairs(orgfile:get_opened_unfinished_headlines()) do
for _, date in ipairs(headline:get_deadline_and_scheduled_dates()) do
if date:is_same_or_before(today, "day") then
remaining_tasks_today = remaining_tasks_today + 1
break
end
end
end
end
return ("Tasks Remaining: %d"):format(remaining_tasks_today)
end
return clocked_in_task() or remaining_tasks_today()
end, end,
}, },
{ {