-- snacks.nvim: only picker, lazygit, terminal and image are used. -- fff handles files and grep in the full profile; if its native library was -- not built (or in slim), those maps fall back to snacks.picker. local full = vim.g.profile == "full" local fff_built local function use_fff() if fff_built == nil then fff_built = false local plugin = full and require("lazy.core.config").plugins["fff.nvim"] if plugin then local ext = jit.os == "OSX" and "dylib" or "so" fff_built = vim.uv.fs_stat(plugin.dir .. "/target/release/libfff_nvim." .. ext) ~= nil end end return fff_built end local function files() if use_fff() then require("fff").find_files() else Snacks.picker.files() end end local function grep() if use_fff() then require("fff").live_grep() else Snacks.picker.grep() end end local keys = { { "ff", files, desc = "Find files" }, { "fg", grep, desc = "Live grep" }, { "fw", function() Snacks.picker.grep_word() end, desc = "Grep word under cursor", mode = { "n", "x" } }, { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, { "fh", function() Snacks.picker.help() end, desc = "Help" }, { "fk", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, { "fd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, { "", function() Snacks.terminal.toggle(nil, { win = { position = "float" } }) end, desc = "Toggle terminal", mode = { "n", "t" } }, { "", function() Snacks.terminal.toggle(nil, { win = { position = "float" } }) end, desc = "which_key_ignore", mode = { "n", "t" } }, } if full then table.insert(keys, { "fs", function() Snacks.picker.lsp_workspace_symbols() end, desc = "Workspace symbols" }) end if vim.fn.executable("lazygit") == 1 then table.insert(keys, { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }) end local picker = {} if full then -- sends selected files or grep hits to the running agent. picker = { actions = { sidekick_send = function(...) return require("sidekick.cli.picker.snacks").send(...) end, }, win = { input = { keys = { [""] = { "sidekick_send", mode = { "n", "i" } } } } }, } end return { { "folke/snacks.nvim", lazy = false, priority = 1000, keys = keys, opts = { picker = picker, lazygit = {}, terminal = {}, image = { enabled = full }, }, }, { "dmtrKovalenko/fff.nvim", cond = full, lazy = true, -- Only the Lua library; the workspace also has bins that fail to link. build = "cargo build --release -p fff-nvim --lib", opts = {}, }, }