diff --git a/lua/409/plugins/startup.lua b/lua/409/plugins/startup.lua new file mode 100644 index 0000000..8954ad0 --- /dev/null +++ b/lua/409/plugins/startup.lua @@ -0,0 +1,85 @@ +return { + { + "goolord/alpha-nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + lazy = false, + keys = { + { + "", + function() + if vim.bo.filetype ~= "alpha" then + vim.cmd("Alpha") + end + end, + desc = "Home screen", + } + }, + config = function() + local dashboard = require("alpha.themes.dashboard") + + dashboard.section.header.val = { + " @@@ @@@@@@@@ @@@@@@ ", + " @@@@ @@@@@@@@@@ @@@@@@@@ ", + " @@!@! @@! @@@@ @@! @@@ ", + " !@!!@! !@! @!@!@ !@! @!@ ", + " @!! @!! @!@ @! !@! !!@!!@!! ", + "!!! !@! !@!!! !!! !!@!!! ", + ":!!:!:!!: !!:! !!! !!! ", + "!:::!!::: :!: !:! !:! ", + " ::: ::::::: :: ::::: :: ", + " ::: : : : : : : : ", + } + + dashboard.section.header.opts.hl = "DashboardHeader" + dashboard.section.footer.hl = "DashboardFooter" + + dashboard.leader = "LDR" + + --- @param shortcut string Shortcut string of a button mapping + --- @param desc string Real text description of the mapping + --- @param rhs string? Righthand side of mapping if defining a new mapping (_optional_) + --- @param map_opts table? `keymap.set` options used during keymap creating (_optional_) + dashboard.button = function(shortcut, desc, rhs, map_opts) + local lhs = shortcut:gsub("%s", ""):gsub(dashboard.leader, "") + local default_map_opts = { noremap = true, silent = true, nowait = true, desc = desc } + + local leader = vim.g.mapleader + if leader == " " then + leader = "󱁐" + end + + return { + type = "button", + val = desc, + on_press = function() + vim.api.nvim_feedkeys( + vim.api.nvim_replace_termcodes(rhs or lhs .. "", true, false, true), + "t", + false + ) + end, + opts = { + position = "center", + shortcut = shortcut:gsub(dashboard.leader, leader), + cursor = -2, + width = 36, + align_shortcut = "right", + hl = "DashboardCenter", + hl_shortcut = "DashboardShortcut", + keymap = rhs and { "n", lhs, rhs, require("astrocore").extend_tbl(default_map_opts, map_opts) }, + }, + } + end + + dashboard.section.buttons.val = { + dashboard.button("LDR LDR ", " Return to this screen"), + dashboard.button("LDR p v", " Explore"), + dashboard.button("LDR p f", " Find File"), + dashboard.button("LDR p f", " Find Git File"), + dashboard.button("LDR p l", " Find Word"), + } + + require("alpha").setup(dashboard.config) + end, + }, +} diff --git a/lua/409/plugins/theme.lua b/lua/409/plugins/theme.lua index 9fe4a9b..b6cef1c 100644 --- a/lua/409/plugins/theme.lua +++ b/lua/409/plugins/theme.lua @@ -17,6 +17,8 @@ return { vim.api.nvim_set_hl(0, "TabLine", { fg = "#f8f8f2", bg = "#44475a" }) vim.api.nvim_set_hl(0, "TabLineSel", { fg = "#282a36", bg = "#50fa7b", bold = true }) + vim.api.nvim_set_hl(0, "DashboardHeader", { fg = "#50fa7b" }) + vim.api.nvim_set_hl(0, "DashboardShortCut", { fg = "#bd93f9" }) end, }, }