From 319276a7853ff996b7bb1ed4250d8047c84ad29d Mon Sep 17 00:00:00 2001 From: Tonitum Date: Mon, 22 Apr 2024 02:14:27 -0600 Subject: [PATCH] fix: daily/weekly search when the folder is set to the base folder * refs 321-daily-weekly-picker: feat: added plenary pattern/depth options to address behavior when the weekly/daily folder is configured to the same as the base notes folder * refs 321-daily-weekly-picker: format: address styling closes #321 --- lua/telekasten.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 233676f..bb77cef 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -893,8 +893,11 @@ local picker_actions = {} -- - this requires the telescope-media-files.nvim extension local function find_files_sorted(opts) opts = opts or {} + local search_pattern = opts.search_pattern or nil + local search_depth = opts.search_depth or nil + local scan_opts = { search_pattern = search_pattern, depth = search_depth } - local file_list = scan.scan_dir(opts.cwd, {}) + local file_list = scan.scan_dir(opts.cwd, scan_opts) local filter_extensions = opts.filter_extensions or M.Cfg.filter_extensions file_list = filter_filetypes(file_list, filter_extensions) local sort_option = opts.sort or "filename" @@ -1194,6 +1197,8 @@ local function FindDailyNotes(opts) prompt_title = "Find daily note", cwd = M.Cfg.dailies, find_command = M.Cfg.find_command, + search_pattern = "%d%d%d%d%-%d%d%-%d%d", + search_depth = 1, attach_mappings = function(_, map) actions.select_default:replace( picker_actions.select_default @@ -1261,6 +1266,8 @@ local function FindWeeklyNotes(opts) prompt_title = "Find weekly note", cwd = M.Cfg.weeklies, find_command = M.Cfg.find_command, + search_pattern = "%d%d%d%d%-W%d+", + search_depth = 1, attach_mappings = function(_, map) actions.select_default:replace( picker_actions.select_default