From 7bd94673bcb662022cdf7e04e70cce7ccc396c39 Mon Sep 17 00:00:00 2001 From: max397574 Date: Wed, 30 Mar 2022 09:54:46 +0200 Subject: [PATCH] refactor: use `states` from utils --- lua/telescope/_extensions/neorg/find_aof_tasks.lua | 11 +---------- .../_extensions/neorg/find_context_tasks.lua | 12 ++---------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/lua/telescope/_extensions/neorg/find_aof_tasks.lua b/lua/telescope/_extensions/neorg/find_aof_tasks.lua index 7ea31e6..b328cc7 100644 --- a/lua/telescope/_extensions/neorg/find_aof_tasks.lua +++ b/lua/telescope/_extensions/neorg/find_aof_tasks.lua @@ -14,16 +14,7 @@ local neorg_loaded, _ = pcall(require, "neorg.modules") assert(neorg_loaded, "Neorg is not loaded - please make sure to load Neorg first") -local states = { - ["undone"] = { "-[ ] ", "NeorgTodoItem1Undone" }, - ["done"] = { "-[x] ", "NeorgTodoItem1Done" }, - ["pending"] = { "-[-] ", "NeorgTodoItem1Pending" }, - ["cancelled"] = { "-[_] ", "NeorgTodoItem1Cancelled" }, - ["uncertain"] = { "-[?] ", "NeorgTodoItem1Uncertain" }, - ["urgent"] = { "-[!] ", "NeorgTodoItem1Urgent" }, - ["recurring"] = { "-[+] ", "NeorgTodoItem1Recurring" }, - ["on_hold"] = { "-[=] ", "NeorgTodoItem1OnHold" }, -} +local states = utils.states local function get_aof_projects() local projects = utils.get_projects() diff --git a/lua/telescope/_extensions/neorg/find_context_tasks.lua b/lua/telescope/_extensions/neorg/find_context_tasks.lua index 4846cbf..80937f4 100644 --- a/lua/telescope/_extensions/neorg/find_context_tasks.lua +++ b/lua/telescope/_extensions/neorg/find_context_tasks.lua @@ -1,3 +1,4 @@ +local utils = require("neorg.telescope_utils") local actions = require("telescope.actions") local actions_set = require("telescope.actions.set") local state = require("telescope.actions.state") @@ -13,16 +14,7 @@ local neorg_loaded, _ = pcall(require, "neorg.modules") assert(neorg_loaded, "Neorg is not loaded - please make sure to load Neorg first") -local states = { - ["undone"] = { "-[ ] ", "NeorgTodoItem1Undone" }, - ["done"] = { "-[x] ", "NeorgTodoItem1Done" }, - ["pending"] = { "-[-] ", "NeorgTodoItem1Pending" }, - ["cancelled"] = { "-[_] ", "NeorgTodoItem1Cancelled" }, - ["uncertain"] = { "-[?] ", "NeorgTodoItem1Uncertain" }, - ["urgent"] = { "-[!] ", "NeorgTodoItem1Urgent" }, - ["recurring"] = { "-[+] ", "NeorgTodoItem1Recurring" }, - ["on_hold"] = { "-[=] ", "NeorgTodoItem1OnHold" }, -} +local states = utils.states local function get_context_tasks() local tasks_raw = neorg.modules.get_module("core.gtd.queries").get("tasks")