- Fix missing path separator in glob patterns (files were not found) - Fix nvim-tree setup overriding user config on every IdeaTree call - Fix deprecated nvim API (nvim_buf_set_option, nvim_win_set_option) - Fix missing arguments in sidebar.open() call in list.lua - Remove unused variable in tags.lua - Update help documentation with all commands - Fix README.md (telescope reference, add changelog link) - Add CHANGELOG.md - Add llms.txt for AI/LLM context
32 lines
831 B
Lua
32 lines
831 B
Lua
-- ideaDrop/features/list.lua
|
|
local config = require("ideaDrop.core.config")
|
|
local sidebar = require("ideaDrop.ui.sidebar")
|
|
|
|
---@class List
|
|
---@field list_all fun(): nil
|
|
local M = {}
|
|
|
|
---Lists all idea files and allows user to select one to open
|
|
---@return nil
|
|
function M.list_all()
|
|
local path = config.options.idea_dir
|
|
-- Find all .md files recursively
|
|
local files = vim.fn.glob(path .. "/**/*.md", false, true)
|
|
|
|
if #files == 0 then
|
|
vim.notify("📂 No idea files found", vim.log.levels.INFO)
|
|
return
|
|
end
|
|
|
|
-- Present file selection UI
|
|
vim.ui.select(files, { prompt = "📂 Select an idea file to open:" }, function(choice)
|
|
if choice then
|
|
local filename = vim.fn.fnamemodify(choice, ":t")
|
|
sidebar.open(choice, filename, false) -- Open the selected file in sidebar
|
|
end
|
|
end)
|
|
end
|
|
|
|
return M
|
|
|