mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
fix(snacks): cleaner way to adjust keys preset
This commit is contained in:
parent
0bb1da6d57
commit
9c31004365
2 changed files with 29 additions and 11 deletions
|
@ -152,6 +152,9 @@ return {
|
|||
"nvimdev/dashboard-nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if not vim.tbl_get(opts, "config", "center") then
|
||||
return
|
||||
end
|
||||
local projects = {
|
||||
action = pick,
|
||||
desc = " Projects",
|
||||
|
@ -165,4 +168,17 @@ return {
|
|||
table.insert(opts.config.center, 3, projects)
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.dashboard.preset.keys, 3, {
|
||||
action = pick,
|
||||
desc = "Projects",
|
||||
icon = " ",
|
||||
key = "p",
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -319,17 +319,19 @@ return {
|
|||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]],
|
||||
---@param keys snacks.dashboard.Item[]
|
||||
keys = function(keys)
|
||||
-- add LazyExtra before Lazy
|
||||
for k, key in ipairs(keys) do
|
||||
if key.action == ":Lazy" then
|
||||
key.key = "l" -- we don't have multiple panes, so `l` is free
|
||||
table.insert(keys, k, { icon = " ", desc = "Lazy Extras", action = ":LazyExtras", key = "x" })
|
||||
break
|
||||
end
|
||||
end
|
||||
end,
|
||||
-- stylua: ignore
|
||||
---@type snacks.dashboard.Item[]
|
||||
keys = {
|
||||
{ icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
|
||||
{ icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" },
|
||||
{ icon = " ", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
|
||||
{ icon = " ", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
|
||||
{ icon = " ", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
|
||||
{ icon = " ", key = "s", desc = "Restore Session", section = "session" },
|
||||
{ icon = " ", key = "x", desc = "Lazy Extras", action = ":LazyExtras" },
|
||||
{ icon = " ", key = "l", desc = "Lazy", action = ":Lazy" },
|
||||
{ icon = " ", key = "q", desc = "Quit", action = ":qa" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue