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
This commit is contained in:
Tonitum
2024-04-22 02:14:27 -06:00
committed by GitHub
parent 24fd8c1e7e
commit 319276a785

View File

@@ -893,8 +893,11 @@ local picker_actions = {}
-- - this requires the telescope-media-files.nvim extension -- - this requires the telescope-media-files.nvim extension
local function find_files_sorted(opts) local function find_files_sorted(opts)
opts = opts or {} 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 local filter_extensions = opts.filter_extensions or M.Cfg.filter_extensions
file_list = filter_filetypes(file_list, filter_extensions) file_list = filter_filetypes(file_list, filter_extensions)
local sort_option = opts.sort or "filename" local sort_option = opts.sort or "filename"
@@ -1194,6 +1197,8 @@ local function FindDailyNotes(opts)
prompt_title = "Find daily note", prompt_title = "Find daily note",
cwd = M.Cfg.dailies, cwd = M.Cfg.dailies,
find_command = M.Cfg.find_command, find_command = M.Cfg.find_command,
search_pattern = "%d%d%d%d%-%d%d%-%d%d",
search_depth = 1,
attach_mappings = function(_, map) attach_mappings = function(_, map)
actions.select_default:replace( actions.select_default:replace(
picker_actions.select_default picker_actions.select_default
@@ -1261,6 +1266,8 @@ local function FindWeeklyNotes(opts)
prompt_title = "Find weekly note", prompt_title = "Find weekly note",
cwd = M.Cfg.weeklies, cwd = M.Cfg.weeklies,
find_command = M.Cfg.find_command, find_command = M.Cfg.find_command,
search_pattern = "%d%d%d%d%-W%d+",
search_depth = 1,
attach_mappings = function(_, map) attach_mappings = function(_, map)
actions.select_default:replace( actions.select_default:replace(
picker_actions.select_default picker_actions.select_default