diff --git a/lua/timer.lua b/lua/timer.lua index 294c1f3..83b48c4 100644 --- a/lua/timer.lua +++ b/lua/timer.lua @@ -132,6 +132,20 @@ local function log_time_table() end end +local function focus_gained() + table.insert(focus_events, { + time = os.time(), + event = "gain", + }) +end + +local function focus_lost() + table.insert(focus_events, { + time = os.time(), + event = "lose", + }) +end + local function persist() local today = os.date("%y-%m-%d", os.time()) @@ -162,7 +176,7 @@ local function persist() return end - file:write("## dates and their corresponding seconds been here :)\n", TOML.encode(table), "\n") + file:write("## dates and their corresponding seconds been here :)\n", TOML.encode(table), "\n") file.close() --reset timer @@ -170,19 +184,6 @@ local function persist() focus_events = {} focus_gained() end -local function focus_gained() - table.insert(focus_events, { - time = os.time(), - event = "gain", - }) -end - -local function focus_lost() - table.insert(focus_events, { - time = os.time(), - event = "lose", - }) -end local function setup() vim.api.nvim_create_autocmd("VimEnter",