125 lines
5.9 KiB
Lua
125 lines
5.9 KiB
Lua
-- стартовый экран
|
|
return {
|
|
"goolord/alpha-nvim",
|
|
config = function()
|
|
local alpha = require"alpha"
|
|
|
|
-- устанавливаем стиль
|
|
local group = { AlphaHeader = { fg = "#4e4e58" }, AlphaButtons = { fg = "#5a5a64" } }
|
|
for hl, col in pairs(group) do
|
|
vim.api.nvim_set_hl(0, hl, col)
|
|
end
|
|
|
|
local function button(sc, txt, keybind)
|
|
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
|
|
|
|
local opts = {
|
|
position = "center",
|
|
text = txt,
|
|
shortcut = sc,
|
|
cursor = 5,
|
|
width = 36,
|
|
align_shortcut = "right",
|
|
hl = "AlphaButtons"
|
|
}
|
|
|
|
if keybind then
|
|
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
|
|
end
|
|
|
|
return {
|
|
type = "button",
|
|
val = txt,
|
|
on_press = function()
|
|
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) or ""
|
|
vim.api.nvim_feedkeys(key, "normal", false)
|
|
end,
|
|
opts = opts
|
|
}
|
|
end
|
|
|
|
-- отступы
|
|
local fn = vim.fn
|
|
local marginTopPercent = 0.3
|
|
local headerPadding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
|
|
|
|
local options = {
|
|
header = {
|
|
type = "text",
|
|
val = {
|
|
[[⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣴⡶⠶⠒⠛⠛⠛⠛⠒⠶⢶⣦⣤⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
|
[[⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣶⠞⠋⠉⠁⣀⠀⠀⠀⣴⣶⣦⡀⣠⣴⣦⠀⠈⠉⠙⠳⣶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀]],
|
|
[[⠀⠀⠀⠀⠀⠀⠀⣀⣴⠟⠉⠀⣀⠀⣀⣾⣿⣷⣦⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣀⣴⡆⠀⠉⠻⣦⣀⠀⠀⠀⠀⠀⠀⠀]],
|
|
[[⠀⠀⠀⠀⠀⢠⡾⠋⠀⡀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣤⣷⠀⠀⠙⢷⡄⠀⠀⠀⠀⠀]],
|
|
[[⠀⠀⠀⢀⣴⠟⠀⠀⠀⣿⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠻⣦⡀⠀⠀⠀]],
|
|
[[⠀⠀⢠⣾⠃⠀⠀⠀⠈⣿⣿⣿⣿⣿⣿⠿⣿⣟⠛⠉⢿⣿⢯⡛⠉⠛⠿⣿⣟⢿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠘⣷⡄⠀⠀]],
|
|
[[⠀⠀⡾⠁⠀⠀⠀⠀⠀⣹⣿⣿⣿⡏⠀⠁⠀⠀⠀⠀⠀⠉⠁⠑⠀⠀⠀⠀⠀⠁⠙⣿⣿⣿⡇⠀⠀⠀⠀⠀⠈⢷⠀⠀]],
|
|
[[⠀⣾⠃⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠘⣷⠀]],
|
|
[[⢰⡟⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⡏⡀⠄⠚⠙⢄⠀⠀⠀⠀⠀⠀⠀⠀⡠⠋⡀⠓⠄⣿⣿⡗⠀⠀⠀⠀⠀⠀⠀⠀⢻⡆]],
|
|
[[⢸⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡇⠀⠐⢢⡐⢌⠑⡄⠀⠀⠀⠀⢀⠎⡡⣢⠕⠉⢰⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠘⡇]],
|
|
[[⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⡎⠈⠢⢕⡈⠂⠀⠀⠲⢁⠲⠊⠉⡆⠀⢸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿]],
|
|
[[⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠊⠃⠀⠀⡇⠰⠆⢸⣾⡀⠀⠀⢀⣿⠀⢰⠀⠀⠀⠀⠏⠒⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿]],
|
|
[[⢸⡀⠀⠀⠀⠀⠀⠀⠀⡜⠀⣤⡃⠸⣭⣫⣉⡓⠾⠛⡃⠀⢀⠚⠻⢞⣋⣉⣯⠇⠸⡘⠉⢸⠀⠀⠀⠀⠀⠀⠀⠀⢠⡇]],
|
|
[[⠸⣧⠀⠀⠀⠀⠀⠀⠀⢇⠀⢁⡇⠀⠉⠉⠉⠉⠉⠉⡅⠀⠈⠉⠉⠉⠉⠉⠉⠀⠀⠓⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⣼⠇]],
|
|
[[⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠈⣴⠀⠀⠀⠀⠀⠀⠀⠐⢀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠈⡄⠀⠀⠀⠀⠀⠀⠀⠀⢠⡿⠀]],
|
|
[[⠀⠀⢷⡀⠀⠀⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠎⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⠀⠀⠀⠀⢀⡾⠀⠀]],
|
|
[[⠀⠀⠘⢿⡄⠀⠀⠀⠀⠀⢰⠀⠀⠀⠀⠀⠀⠀⢀⠤⠐⢋⡀⠸⠀⠀⠀⠀⠀⠀⠀⠀⢠⠇⠀⠀⠀⠀⠀⢠⡿⠃⠀⠀]],
|
|
[[⠀⠀⠀⠈⠻⣦⠀⠀⠀⠀⠈⡀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠁⠈⠁⠆⠀⠀⠀⠀⠀⠀⢀⠞⠀⠀⠀⠀⠀⣴⠟⠁⠀⠀⠀]],
|
|
[[⠀⠀⠀⠀⠀⠘⢷⣄⠀⠀⠀⠁⠠⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡤⠤⠒⠋⠀⠀⠀⠀⣠⡾⠃⠀⠀⠀⠀⠀]],
|
|
[[⠀⠀⠀⠀⠀⠀⠀⠉⠻⣦⣀⠀⠀⠀⠀⠀⠁⠀⢄⠀⠀⠀⠀⠀⠀⢀⠌⠀⠀⠀⠀⠀⠀⣀⣴⠟⠉⠀⠀⠀⠀⠀⠀⠀]],
|
|
[[⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⢦⣄⣀⡀⠀⠀⠀⠈⠠⠀⣀⡀⠄⠁⠀⠀⢀⣀⣠⡴⠿⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀]],
|
|
[[⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠻⠷⠶⠤⣤⣤⣤⣤⠤⠶⠾⠟⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀]],
|
|
},
|
|
opts = {
|
|
position = "center",
|
|
hl = "AlphaHeader"
|
|
}
|
|
},
|
|
|
|
buttons = {
|
|
type = "group",
|
|
val = {
|
|
button(".", " Open current", ":ene <CR>:NvimTreeFindFileToggle<CR>"),
|
|
button("u", " Update", ":!backup_nvim<CR> | :Lazy<CR>"),
|
|
button("f", " Find file", ":Telescope find_files<CR>"),
|
|
button("r", " Recent File", ":Telescope oldfiles<CR>"),
|
|
button("w", " Find Word", ":Telescope live_grep<CR>"),
|
|
button("c", " Configs", ":e $MYVIMRC | :cd %:p:h <CR>:NvimTreeFindFileToggle<CR>"),
|
|
},
|
|
opts = {
|
|
spacing = 1
|
|
}
|
|
},
|
|
|
|
headerPaddingTop = { type = "padding", val = headerPadding },
|
|
headerPaddingBottom = { type = "padding", val = 2 }
|
|
}
|
|
|
|
alpha.setup {
|
|
layout = {
|
|
options.headerPaddingTop,
|
|
options.header,
|
|
options.headerPaddingBottom,
|
|
options.buttons
|
|
},
|
|
opts = {}
|
|
}
|
|
|
|
-- отключаем statusline
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = "alpha",
|
|
callback = function()
|
|
-- сохраняем текущее statusline
|
|
local old_laststatus = vim.opt.laststatus
|
|
vim.api.nvim_create_autocmd("BufUnload", {
|
|
buffer = 0,
|
|
callback = function()
|
|
vim.opt.laststatus = old_laststatus
|
|
end,
|
|
})
|
|
vim.opt.laststatus = 0
|
|
end
|
|
})
|
|
end
|
|
}
|