diff options
| author | triethyl <triethylammonium@pm.me> | 2025-07-12 22:23:30 -0400 |
|---|---|---|
| committer | triethyl <triethylammonium@pm.me> | 2025-07-12 22:23:30 -0400 |
| commit | fd886e18472da2884ea6c593aecfbfc7bc658cbf (patch) | |
| tree | 9c73269099050294d1f3b9f0eecf62b6d99591f5 /pkgs/custom-neovim/config/lua/plugins/snacks.lua | |
| parent | 93291a3f4f2db070e9470fd9780b2b15ad893e17 (diff) | |
working on custom nvim
Former-commit-id: 7eeb50b4c2b95b3d917b37a3a6f0b98ed7b0d077
Diffstat (limited to 'pkgs/custom-neovim/config/lua/plugins/snacks.lua')
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/snacks.lua | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/pkgs/custom-neovim/config/lua/plugins/snacks.lua b/pkgs/custom-neovim/config/lua/plugins/snacks.lua index 57c3bc9..324b013 100644 --- a/pkgs/custom-neovim/config/lua/plugins/snacks.lua +++ b/pkgs/custom-neovim/config/lua/plugins/snacks.lua @@ -1,4 +1,60 @@ require("snacks").setup { bigfile = { enabled = true }, picker = { enabled = true }, + dashboard = { + width = 60, + row = nil, -- dashboard position. nil for center + col = nil, -- dashboard position. nil for center + pane_gap = 4, -- empty columns between vertical panes + autokeys = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", -- autokey sequence + -- These settings are used by some built-in sections + preset = { + -- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick` + ---@type fun(cmd:string, opts:table)|nil + pick = nil, + -- Used by the `keys` section to show keymaps. + -- Set your custom keymaps here. + -- When using a function, the `items` argument are the default keymaps. + ---@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 = "q", desc = "Quit", action = ":qa" }, + }, + -- Used by the `header` section + header = table.concat(Art.misc.hydra, "\n"), + }, + -- item field formatters + formats = { + icon = function(item) + if item.file and item.icon == "file" or item.icon == "directory" then + return M.icon(item.file, item.icon) + end + return { item.icon, width = 2, hl = "icon" } + end, + footer = { "%s", align = "center" }, + header = { "%s", align = "center" }, + file = function(item, ctx) + local fname = vim.fn.fnamemodify(item.file, ":~") + fname = ctx.width and #fname > ctx.width and vim.fn.pathshorten(fname) or fname + if #fname > ctx.width then + local dir = vim.fn.fnamemodify(fname, ":h") + local file = vim.fn.fnamemodify(fname, ":t") + if dir and file then + file = file:sub(-(ctx.width - #dir - 2)) + fname = dir .. "/…" .. file + end + end + local dir, file = fname:match("^(.*)/(.+)$") + return dir and { { dir .. "/", hl = "dir" }, { file, hl = "file" } } or { { fname, hl = "file" } } + end, + }, + sections = { + { section = "header" }, + { section = "keys", gap = 1, padding = 1 }, + }, + } } |
