From 58e517b171e474de65ae085f2c681020970125b2 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 4 Dec 2024 17:50:03 -0500 Subject: [PATCH] AutoYADM commit: 2024-12-04 17:50:03 --- .config/nvim/lua/plugins/dash.lua | 173 ++++++++++++++++-------------- 1 file changed, 94 insertions(+), 79 deletions(-) diff --git a/.config/nvim/lua/plugins/dash.lua b/.config/nvim/lua/plugins/dash.lua index 74a32aa9..599a0553 100644 --- a/.config/nvim/lua/plugins/dash.lua +++ b/.config/nvim/lua/plugins/dash.lua @@ -1,90 +1,105 @@ return { "folke/snacks.nvim", - priority = 1000, - lazy = false, - opts = { dashboard = { - { - enabled = true, - 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 = "s", desc = "Restore Session", section = "session" }, - { icon = "󰒲 ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, - { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + 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')})", }, - header = [[ - _.oo. - _.u[[/;:,. .odMMMMMM' - .o888UU[[[/;:-. .o@P^ MMM^ - oN88888UU[[[/;::-. dP^ - dNMMNN888UU[[[/;:--. .o@P^ - ,MMMMMMN888UU[[/;::-. o@^ - NNMMMNN888UU[[[/~.o@P^ - 888888888UU[[[/o@^-.. - oI8888UU[[[/o@P^:--.. - .@^ YUU[[[/o@^;::---.. - oMP ^/o@P^;:::---.. - .dMMM .o@^ ^;::---... - dMMMMMMM@^` `^^^^ -YMMMUP^ - ^^ -]], -- Used by the `header` section + { icon = " ", key = "s", desc = "Restore Session", section = "session" }, + { icon = "󰒲 ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, }, - -- 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) + -- Used by the `header` section + header = [[ +███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ +████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ +██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ +██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ +██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ +╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]], + }, + -- 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 - 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 }, - { section = "startup" }, - }, + 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 }, + { section = "startup" }, }, }, }, } +-- return { +-- "folke/snacks.nvim", +-- opts = { +-- dashboard = { +-- preset = { +-- header = [[ +-- ██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z +-- ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z +-- ██║ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX█╔████╔██║ z +-- ██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z +-- ███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ +-- ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ +-- ]], +-- -- 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" }, +-- }, +-- }, +-- }, +-- }, +-- }