diff --git a/lua/lazyvim/plugins/extras/util/project.lua b/lua/lazyvim/plugins/extras/util/project.lua index 16e72077..fc74929b 100644 --- a/lua/lazyvim/plugins/extras/util/project.lua +++ b/lua/lazyvim/plugins/extras/util/project.lua @@ -1,24 +1,50 @@ +local pick = function() + if pcall(require, "telescope") then + return vim.cmd("Telescope projects") + end + + local fzf_lua = require("fzf-lua") + local history = require("project_nvim.utils.history") + local results = history.get_recent_projects() + fzf_lua.fzf_exec(results, { + actions = { + ["default"] = { + function(selected) + fzf_lua.files({ cwd = selected[1] }) + end, + }, + }, + }) +end + return { + { + "ahmedkhalf/project.nvim", + opts = { + manual_mode = true, + }, + event = "VeryLazy", + config = function(_, opts) + require("project_nvim").setup(opts) + LazyVim.on_load("telescope.nvim", function() + require("telescope").load_extension("projects") + end) + end, + }, + { "telescope.nvim", - dependencies = { - -- project management - { - "ahmedkhalf/project.nvim", - opts = { - manual_mode = true, - }, - event = "VeryLazy", - config = function(_, opts) - require("project_nvim").setup(opts) - LazyVim.on_load("telescope.nvim", function() - require("telescope").load_extension("projects") - end) - end, - keys = { - { "fp", "Telescope projects", desc = "Projects" }, - }, - }, + optional = true, + keys = { + { "fp", pick, desc = "Projects" }, + }, + }, + + { + "ibhagwan/fzf-lua", + optional = true, + keys = { + { "fp", pick, desc = "Projects" }, }, }, @@ -26,12 +52,13 @@ return { "goolord/alpha-nvim", optional = true, opts = function(_, dashboard) - local button = dashboard.button("p", " " .. " Projects", ":Telescope projects ") + local button = dashboard.button("p", " " .. " Projects", pick) button.opts.hl = "AlphaButtons" button.opts.hl_shortcut = "AlphaShortcut" table.insert(dashboard.section.buttons.val, 4, button) end, }, + { "echasnovski/mini.starter", optional = true, @@ -39,19 +66,20 @@ return { local items = { { name = "Projects", - action = "Telescope projects", + action = pick, section = string.rep(" ", 22) .. "Telescope", }, } vim.list_extend(opts.items, items) end, }, + { "nvimdev/dashboard-nvim", optional = true, opts = function(_, opts) local projects = { - action = "Telescope projects", + action = pick, desc = " Projects", icon = " ", key = "p",