diff options
author | Squibid <me@zacharyscheiman.com> | 2023-04-30 18:41:13 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2023-04-30 18:41:13 -0400 |
commit | 01a09f243ce07d367c539d69d4a7f4541ab1dcd7 (patch) | |
tree | ec2af23e59a38d4f9ac476e69abc07c8110b52a1 /after/plugin/startpage.lua | |
parent | 7c5d3eff786bef884022cc813448bb085ba4eccd (diff) | |
download | nvim-01a09f243ce07d367c539d69d4a7f4541ab1dcd7.tar.gz nvim-01a09f243ce07d367c539d69d4a7f4541ab1dcd7.tar.bz2 nvim-01a09f243ce07d367c539d69d4a7f4541ab1dcd7.zip |
new config old version is now on v1 branch
Diffstat (limited to 'after/plugin/startpage.lua')
-rw-r--r-- | after/plugin/startpage.lua | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/after/plugin/startpage.lua b/after/plugin/startpage.lua new file mode 100644 index 0000000..2f12e56 --- /dev/null +++ b/after/plugin/startpage.lua @@ -0,0 +1,71 @@ +local status_ok, alpha = pcall(require, "alpha") +if not status_ok then + return +end + +-- buttons +local function button(sc, txt, keybind) + local opts = { + position = "center", + shortcut = sc, + cursor = 5, + width = 80, + align_shortcut = "right", + hl_shortcut = "Keyword", + } + local function on_press() + local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true) + vim.api.nvim_feedkeys(key, "t", false) + end + + return { + type = "button", + val = txt, + on_press = on_press, + opts = opts, + } +end + +-- actual config +local R = {} + +R.width = vim.api.nvim_win_get_width(0) +R.height = vim.api.nvim_win_get_height(0) + +if R.width >= 120 then + alpha.setup { + layout = { + { type = "padding", val = math.floor(R.height / 2.5) }, + button([[ `'::. `'::::. ]], "Recent Files", "<cmd>Telescope oldfiles<CR>"), + button([[ _________H ,%%&%, _____A_ ]], "New File", "<cmd>ene<CR>"), + button([[ /\ _ \%&&%%&% / /\ ]], "Update Plugins", "<cmd>DepSync<CR>"), + button([[ / \___/^\___\%&%%&& __/__/\__/ \___ ]], "", ""), + button([[ | | [] [] |%\Y&%' /__|" '' "| /___/\ ]], "", ""), + button([[ | | .-. | || |''|"'||'"| |' '|| ]], "", ""), + button([[~~@._|@@_|||_@@|~||~~~ ~`""`""))""`"`""""`~~]], "", ""), + button([[ `""") )"""` // ]], "", ""), + } + } +end +if R.width <= 119 then + local header = { + [[ `'::. `'::::. ]], + [[ _________H ,%%&%, _____A_ ]], + [[ /\ _ \%&&%%&% / /\ ]], + [[ / \___/^\___\%&%%&& __/__/\__/ \___ ]], + [[ | | [] [] |%\Y&%' /__|" '' "| /___/\ ]], + [[ | | .-. | || |''|"'||'"| |' '|| ]], + [[~~@._|@@_|||_@@|~||~~~ ~`""`""))""`"`""""`~~]], + [[ `""") )"""` // ]], + } + alpha.setup { + layout = { + { type = "padding", val = math.floor(R.height / 2.5) }, + { type = "text", val = header, opts = { position = "center", hl = "AlphaHeader" } }, + { type = "padding", val = 1 }, + button([[]], "Recent Files", "<cmd>Telescope oldfiles<CR>"), + button([[]], "New File", "<cmd>ene<CR>"), + button([[]], "Update Plugins", "<cmd>DepSync<CR>"), + } + } +end |