feat(plugins): add LSP symbols finder to smart picker
This commit is contained in:
1 parent
0410c40ac1
commit
f5a1ec1e88
2 files changed
+20
No files matched your search
@@ -226,6 +226,12 @@ return {
|
|||||||
function() require("snacks").picker.git_files { transform = file_filter } end,
|
function() require("snacks").picker.git_files { transform = file_filter } end,
|
||||||
desc = "Find files",
|
desc = "Find files",
|
||||||
},
|
},
|
||||||
|
["<C-f><C-f>"] = {
|
||||||
|
function()
|
||||||
|
require("snacks").picker.lsp_symbols { layout = { preset = "vscode", preview = "main" } }
|
||||||
|
end,
|
||||||
|
desc = "Find LSP symbols",
|
||||||
|
},
|
||||||
["<C-f>o"] = {
|
["<C-f>o"] = {
|
||||||
function() require("snacks").picker.recent() end,
|
function() require("snacks").picker.recent() end,
|
||||||
desc = "Find recent files",
|
desc = "Find recent files",
|
||||||
|
|||||||
@@ -25,6 +25,20 @@ for _, source in ipairs { "files", "git_files", "smart", "recent", "buffers" } d
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Smart picker: anchor to the current git repository. `config` runs when
|
||||||
|
-- the picker opens: cwd becomes the repo root (so the `files` finder scans
|
||||||
|
-- the whole repo, not just a rooter-chdir'd subdir) and `filter.cwd` drops
|
||||||
|
-- buffers/recent entries from other repos. Outside a repo, plain cwd
|
||||||
|
-- behavior is kept.
|
||||||
|
picker_sources.smart.config = function(opts)
|
||||||
|
local root = require("snacks").git.get_root()
|
||||||
|
if root then
|
||||||
|
opts.cwd = root
|
||||||
|
opts.filter = vim.tbl_extend("force", opts.filter or {}, { cwd = true })
|
||||||
|
end
|
||||||
|
return opts
|
||||||
|
end
|
||||||
|
|
||||||
---@type LazySpec
|
---@type LazySpec
|
||||||
return {
|
return {
|
||||||
{ "sphamba/smear-cursor.nvim", opts = {} },
|
{ "sphamba/smear-cursor.nvim", opts = {} },
|
||||||
|
|||||||
Reference in new issue
Block a user