feat(plugins): add ghq-backed project picker shortcut
This commit is contained in:
1 parent
5eb6f57ecd
commit
4bf79169f7
2 files changed
+18
No files matched your search
@@ -280,6 +280,11 @@ return {
|
|||||||
function() require("snacks").picker.smart() end,
|
function() require("snacks").picker.smart() end,
|
||||||
desc = "Find files",
|
desc = "Find files",
|
||||||
},
|
},
|
||||||
|
-- needs a terminal that reports <S-Space> distinctly (kitty keyboard protocol)
|
||||||
|
["<S-Space><S-Space>"] = {
|
||||||
|
function() require("snacks").picker.projects() end,
|
||||||
|
desc = "Find projects",
|
||||||
|
},
|
||||||
["<C-b>b"] = { "<Cmd>BufferLinePick<CR>", desc = "Pick buffer" },
|
["<C-b>b"] = { "<Cmd>BufferLinePick<CR>", desc = "Pick buffer" },
|
||||||
["<C-b>f"] = {
|
["<C-b>f"] = {
|
||||||
function() require("snacks").picker.buffers() end,
|
function() require("snacks").picker.buffers() end,
|
||||||
|
|||||||
@@ -40,6 +40,19 @@ picker_sources.smart.config = function(opts)
|
|||||||
return opts
|
return opts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Projects picker (<Leader>fp, <C-f>p, <S-Space><S-Space>): when the ghq
|
||||||
|
-- CLI is installed, every `ghq list -p` repo joins the recent/dev projects.
|
||||||
|
-- Resolved at open time so newly cloned repos show up without a restart.
|
||||||
|
picker_sources.projects = {
|
||||||
|
config = function(opts)
|
||||||
|
if vim.fn.executable "ghq" == 1 then
|
||||||
|
local repos = vim.fn.systemlist { "ghq", "list", "-p" }
|
||||||
|
if vim.v.shell_error == 0 then opts.projects = vim.list_extend(vim.list_slice(opts.projects or {}), repos) end
|
||||||
|
end
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
---@type LazySpec
|
---@type LazySpec
|
||||||
return {
|
return {
|
||||||
{ "sphamba/smear-cursor.nvim", event = "VeryLazy", opts = {} },
|
{ "sphamba/smear-cursor.nvim", event = "VeryLazy", opts = {} },
|
||||||
|
|||||||
Reference in new issue
Block a user