start of startscreen overhaul

This commit is contained in:
nova 2024-01-30 00:10:59 +01:00
parent 95a377929a
commit 516fe4a063
2 changed files with 36 additions and 175 deletions

View File

@ -53,7 +53,7 @@ local plugins = {
-- },
-- config = function(_, opts)
-- require("nvim-autopairs").setup(opts)
-- end,
-- end,
-- }, -- }}}
-- }}}
@ -69,7 +69,9 @@ local plugins = {
--start screen
{
'goolord/alpha-nvim',
'nvimdev/dashboard-nvim',
event = 'VimEnter',
dependencies = { {'nvim-tree/nvim-web-devicons'}}
},
-- }}}

View File

@ -1,177 +1,36 @@
local alpha = require("alpha")
local col = function(strlist, opts)
-- strlist is a TABLE of TABLES, representing columns of text
-- opts is a text display option
-- column spacing
local padding = 12
-- fill lines up to the maximim length with 'fillchar'
local fillchar = ' '
-- columns padding char (for testing)
local padchar = ' '
-- define maximum string length in a table
local maxlen = function(str)
local max = 0
for i in pairs(str) do
if #str[i] > max then
max = #str[i]
end
end
return max
end
-- add as much right-padding to align the text block
local pad = function(str, max)
local strlist = {}
for i in pairs(str) do
if #str[i] < max then
local newstr = str[i] .. string.rep(fillchar, max-#str[i])
table.insert(strlist, newstr)
else
table.insert(strlist, str[i])
end
end
return strlist
end
-- this is a table for text strings
local values = {}
-- process all the lines
for i=1,maxlen(strlist) do
local str = ''
-- process all the columns but last, because we dont wand extra padding
-- after last column
for column=1,#strlist-1 do
local maxstr = maxlen(strlist[column])
local padded = pad(strlist[column], maxstr)
if strlist[column][i] == nil then
str = str .. string.rep(fillchar, maxstr) .. string.rep(padchar, padding)
else
str = str .. padded[i] .. string.rep(padchar, padding)
end
end
-- lets process the last column, no extra padding
do
local maxstr = maxlen(strlist[#strlist])
local padded = pad(strlist[#strlist], maxstr)
if strlist[#strlist][i] == nil then
str = str .. string.rep(fillchar, maxlen(strlist[#strlist]))
else
str = str .. padded[i]
end
end
-- insert result into output table
table.insert(values, { type = "text", val = str, opts = opts })
end
return values
end
local window_managment = {
"ALT-ENT new tab terminal",
"ALT-NUM move to tab n",
"ALT-v horizontal split",
"ALT-v vertical split",
}
local text_managment = {
"CTRL-t new file",
"CTRL-w :q",
"CTRL-n open file manager"
local dash = require('dashboard')
local custom_header = {
' .█▄╥ _▄K¥▄ ',
' █ `▀▄_ ▄▄ ╓▄▀" ▀▌ ',
' █ "▀▄, ▓ ▀▀▄ ▄▀- █ ',
' ▐▌ ▀▄▌▀▀▀▀`""▀▀█ ▀▄ _▄▀ ▓ ',
' ▓ "▓╥ "▓_.▓▀ ╫ ',
' )▌ ▀█ ╫ ',
' ▐∩ █ ',
' ▐∩ ▐▌ ',
' ▐µ █▌ ',
' ▓ ╨▓▓█▄▄╥_ ,▄▄█████▄ █ ',
' ▐▄ `"▀▀██▄ ▐███▌╓_ .▓" ',
' "▓▄ _▄▄███▀` ▄▄▄▄┐ "▀▀█████▄ .▄K▀▀▀▀█ ',
'▐▌▀▀▀▀ª ▀▀` "▀▄, _ _╥▄▀ ',
' ▓▄ _╥µ __ ,▄▄ ]µ ` ╫▌@╨ ▀▌ ',
' "▀▄` ▓K" *▌▄▄▀" "▀▀▓▀ ▀▄ ',
' █. ▐▌ j▌ _ █ ',
' █ , ▀▄ ▐▌ ▄▓"▀▀▀▀" ',
' ▐█K▀▀"▀¥██▌▄▄_ ╨▓_ _█ ,▄▄K▀▀ ',
' ▐▌ "▀W "▀" "█µ ',
' ▐█ "▓_ ',
' _▓▀ ▀▄ ',
' j█____ _ ▀▄ ',
' ``"▓" ▓⌐ ',
' █ ▐▌ ',
' ▀ ▀ ',
}
local applications = {
"ALT+ESC htop",
"ALT+t termusic",
"ALT+r ranger",
"ALT+m matrix",
dash.setup{
config = {
theme = 'doom',
header = custom_header,
}
}
local head = {
type = "text",
val = {
[[ .█▄╥ _▄K¥▄ ]],
[[ █ '▀▄_ ▄▄ ╓▄▀" ▀▌ ]],
[[ █ "▀▄, ▓ ▀▀▄ ▄▀- █ ]],
[[ ▐▌ ▀▄▌▀▀▀▀'""▀▀█ ▀▄ _▄▀ ▓ ]],
[[ ▓ "▓╥ "▓_.▓▀ ╫ ]],
[[ )▌ ▀█ ╫ ]],
[[ ▐∩ █ ]],
[[ ▐∩ ▐▌ ]],
[[ ▐µ █▌ ]],
[[ ▓ ╨▓▓█▄▄╥_ ,▄▄█████▄ █ ]],
[[ ▐▄ `"▀▀██▄ ▐███▌╓_ .▓" ]],
[[ "▓▄ _▄▄███▀' ▄▄▄▄┐ "▀▀█████▄ .▄K▀▀▀▀█ ]],
[[▐▌▀▀▀▀ª ▀▀' "▀▄, _ _╥▄▀ ]],
[[ ▓▄ _╥µ __ ,▄▄ ]µ ` ╫▌@╨ ▀▌ ]],
[[ "▀▄` ▓K" *▌▄▄▀" "▀▀▓▀ ▀▄ ]],
[[ █. ▐▌ j▌ _ █ ]],
[[ █ , ▀▄ ▐▌ ▄▓"▀▀▀▀" ]],
[[ ▐█K▀▀"▀¥██▌▄▄_ ╨▓_ _█ ,▄▄K▀▀ ]],
[[ ▐▌ "▀W "▀" "█µ ]],
[[ ▐█ "▓_ ]],
[[ _▓▀ ▀▄ ]],
[[ j█____ _ ▀▄ ]],
[[ ''"▓" ▓⌐ ]],
[[ █ ▐▌ ]],
[[ ▀ ▀ ]],
},
opts = {
position = "center",
hl = "Type",
},
}
local foot = {
type = "text",
val = "footer",
opts = {
position = "center",
hl = "Number",
},
}
local block1 = {
type = "group",
val = col({window_managment, text_managment}, { position = "center", hl = {{ "Title", 0, 7 }, {"Comment", 7, 37}, {"Title", 37, 44}, {"Comment", 44, -1}}}),
opts = {
spacing = 0
},
}
local block2 = {
type = "group",
val = col({applications}, { position = "center", hl = {{"Comment", 7, -1}, { "Title", 0, 7 }} }),
opts = {
spacing = 0
},
}
local opts = {
layout = {
{ type = "padding", val = 2 },
head,
{ type = "padding", val = 2 },
block1,
{ type = "padding", val = 2 },
block2,
},
opts = {
noautocmd = true,
margin = 5,
},
}
alpha.setup(opts)