From f49ff037735d7b90410607164de808e46412be0c Mon Sep 17 00:00:00 2001 From: Marcelo Jacobus Date: Mon, 18 Nov 2024 10:38:17 -0300 Subject: [PATCH] Fix listing of files outside root --- lua/plugins/project.lua | 14 ++++++++++++++ lua/plugins/telescope.lua | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 lua/plugins/project.lua create mode 100644 lua/plugins/telescope.lua diff --git a/lua/plugins/project.lua b/lua/plugins/project.lua new file mode 100644 index 0000000..9cfbd6e --- /dev/null +++ b/lua/plugins/project.lua @@ -0,0 +1,14 @@ +-- lua/plugins/project.lua +return { + { + "ahmedkhalf/project.nvim", + config = function() + require("project_nvim").setup({ + detection_methods = { "pattern" }, + patterns = { ".git", "Gemfile", "package.json" }, -- Adjust for your project + sync_root_with_cwd = true, -- Ensure working directory syncs with root + }) + require("telescope").load_extension("projects") + end, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..7405295 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,13 @@ +-- lua/plugins/telescope.lua +-- https://www.lazyvim.org/extras/editor/telescope +return { + "nvim-telescope/telescope.nvim", + opts = function(_, opts) + opts.keys = opts.keys or {} + opts.keys[""] = function() + require("telescope.builtin").find_files({ + cwd = require("project_nvim.project").get_project_root() or vim.fn.getcwd(), + }) + end + end, +}