mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 08:53:33 +02:00
fix(project): add fzf-lua integration. Fixes #3609
This commit is contained in:
parent
46eb3242d3
commit
4b9e4edbb1
1 changed files with 49 additions and 21 deletions
|
@ -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 {
|
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",
|
"telescope.nvim",
|
||||||
dependencies = {
|
optional = true,
|
||||||
-- project management
|
keys = {
|
||||||
{
|
{ "<leader>fp", pick, desc = "Projects" },
|
||||||
"ahmedkhalf/project.nvim",
|
},
|
||||||
opts = {
|
},
|
||||||
manual_mode = true,
|
|
||||||
},
|
{
|
||||||
event = "VeryLazy",
|
"ibhagwan/fzf-lua",
|
||||||
config = function(_, opts)
|
optional = true,
|
||||||
require("project_nvim").setup(opts)
|
keys = {
|
||||||
LazyVim.on_load("telescope.nvim", function()
|
{ "<leader>fp", pick, desc = "Projects" },
|
||||||
require("telescope").load_extension("projects")
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
keys = {
|
|
||||||
{ "<leader>fp", "<Cmd>Telescope projects<CR>", desc = "Projects" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -26,12 +52,13 @@ return {
|
||||||
"goolord/alpha-nvim",
|
"goolord/alpha-nvim",
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = function(_, dashboard)
|
opts = function(_, dashboard)
|
||||||
local button = dashboard.button("p", " " .. " Projects", ":Telescope projects <CR>")
|
local button = dashboard.button("p", " " .. " Projects", pick)
|
||||||
button.opts.hl = "AlphaButtons"
|
button.opts.hl = "AlphaButtons"
|
||||||
button.opts.hl_shortcut = "AlphaShortcut"
|
button.opts.hl_shortcut = "AlphaShortcut"
|
||||||
table.insert(dashboard.section.buttons.val, 4, button)
|
table.insert(dashboard.section.buttons.val, 4, button)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"echasnovski/mini.starter",
|
"echasnovski/mini.starter",
|
||||||
optional = true,
|
optional = true,
|
||||||
|
@ -39,19 +66,20 @@ return {
|
||||||
local items = {
|
local items = {
|
||||||
{
|
{
|
||||||
name = "Projects",
|
name = "Projects",
|
||||||
action = "Telescope projects",
|
action = pick,
|
||||||
section = string.rep(" ", 22) .. "Telescope",
|
section = string.rep(" ", 22) .. "Telescope",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
vim.list_extend(opts.items, items)
|
vim.list_extend(opts.items, items)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvimdev/dashboard-nvim",
|
"nvimdev/dashboard-nvim",
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local projects = {
|
local projects = {
|
||||||
action = "Telescope projects",
|
action = pick,
|
||||||
desc = " Projects",
|
desc = " Projects",
|
||||||
icon = " ",
|
icon = " ",
|
||||||
key = "p",
|
key = "p",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue