mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-08-21 09:48:46 +02:00
feat(extras): add fzf-lua support; refactor extra
This commit is contained in:
parent
969874055c
commit
b9358e20e2
1 changed files with 30 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
||||||
---action after zoxide dir selection
|
---action after zoxide dir selection
|
||||||
---@param path string
|
---@param path string
|
||||||
local function action(path)
|
local function open_zoxide_dir_in_tab(path)
|
||||||
vim.cmd("tabnew")
|
vim.cmd("tabnew")
|
||||||
vim.cmd.tcd(path)
|
vim.cmd.tcd(path)
|
||||||
vim.cmd("setl bufhidden=wipe")
|
vim.cmd("setl bufhidden=wipe")
|
||||||
|
@ -60,27 +60,36 @@ return {
|
||||||
{
|
{
|
||||||
"folke/snacks.nvim",
|
"folke/snacks.nvim",
|
||||||
optional = true,
|
optional = true,
|
||||||
opts = {
|
|
||||||
picker = {
|
|
||||||
---@type table<string, snacks.picker.Config|{}>
|
|
||||||
sources = {
|
|
||||||
zoxide = {
|
|
||||||
confirm = function(picker, item)
|
|
||||||
picker:close()
|
|
||||||
if item then
|
|
||||||
action(item.text)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>sz",
|
"<leader>sz",
|
||||||
function()
|
LazyVim.pick("zoxide", {
|
||||||
Snacks.picker.zoxide()
|
confirm = function(picker, item)
|
||||||
end,
|
picker:close()
|
||||||
|
if item then
|
||||||
|
open_zoxide_dir_in_tab(item.text)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
desc = "Zoxide",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- fzf integration
|
||||||
|
{
|
||||||
|
"ibhagwan/fzf-lua",
|
||||||
|
optional = true,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>sz",
|
||||||
|
LazyVim.pick("zoxide", {
|
||||||
|
actions = {
|
||||||
|
enter = function(selected)
|
||||||
|
local cwd = selected[1]:match("[^\t]+$") or selected[1]
|
||||||
|
open_zoxide_dir_in_tab(cwd)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}),
|
||||||
desc = "Zoxide",
|
desc = "Zoxide",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -98,7 +107,7 @@ return {
|
||||||
mappings = {
|
mappings = {
|
||||||
default = {
|
default = {
|
||||||
action = function(selection)
|
action = function(selection)
|
||||||
action(selection.path)
|
open_zoxide_dir_in_tab(selection.path)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -108,7 +117,7 @@ return {
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>sz",
|
"<leader>sz",
|
||||||
[[<cmd>Telescope zoxide list theme=dropdown previewer=false<cr>]],
|
[[<cmd>Telescope zoxide list<cr>]],
|
||||||
desc = "Zoxide",
|
desc = "Zoxide",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue