mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
fix(dashboard): remove weird preset.keys function override. Just copy defaults if you want to change them
This commit is contained in:
parent
be8feef4ab
commit
0b9e09cbd9
1 changed files with 3 additions and 10 deletions
|
@ -82,7 +82,7 @@ local defaults = {
|
|||
-- Set your curstom keymaps here.
|
||||
-- When using a function, the `items` argument are the default keymaps.
|
||||
-- stylua: ignore
|
||||
---@type snacks.dashboard.Item[]|fun(items:snacks.dashboard.Item[]):snacks.dashboard.Item[]?
|
||||
---@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" },
|
||||
|
@ -90,7 +90,7 @@ local defaults = {
|
|||
{ 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 = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy },
|
||||
{ icon = " ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil },
|
||||
{ icon = " ", key = "q", desc = "Quit", action = ":qa" },
|
||||
},
|
||||
-- Used by the `header` section
|
||||
|
@ -856,14 +856,7 @@ end
|
|||
---@return snacks.dashboard.Gen
|
||||
function M.sections.keys()
|
||||
return function(self)
|
||||
local keys = self.opts.preset.keys
|
||||
if type(keys) == "function" then
|
||||
local default_keys = vim.deepcopy(defaults.preset.keys --[[@as snacks.dashboard.Item[] ]])
|
||||
keys = keys(default_keys) or default_keys
|
||||
else
|
||||
keys = vim.deepcopy(keys)
|
||||
end
|
||||
return vim.deepcopy(keys)
|
||||
return vim.deepcopy(self.opts.preset.keys)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue