replace dashboard with alpha.nvim (#816)
This commit is contained in:
parent
c1e372e2cd
commit
ceaf02e0bf
7 changed files with 95 additions and 66 deletions
|
@ -12,6 +12,7 @@ local folder_bg = colors.folder_bg
|
|||
local green = colors.green
|
||||
local grey = colors.grey
|
||||
local grey_fg = colors.grey_fg
|
||||
local light_grey = colors.light_grey
|
||||
local line = colors.line
|
||||
local nord_blue = colors.nord_blue
|
||||
local one_bg = colors.one_bg
|
||||
|
@ -77,10 +78,8 @@ end
|
|||
-- [[ Plugin Highlights
|
||||
|
||||
-- Dashboard
|
||||
fg("DashboardCenter", grey_fg)
|
||||
fg("DashboardFooter", grey_fg)
|
||||
fg("DashboardHeader", grey_fg)
|
||||
fg("DashboardShortcut", grey_fg)
|
||||
fg("AlphaHeader", grey_fg)
|
||||
fg("AlphaButtons", light_grey)
|
||||
|
||||
-- Git signs
|
||||
fg_bg("DiffAdd", blue, "NONE")
|
||||
|
|
|
@ -63,7 +63,7 @@ M.plugins = {
|
|||
bufferline = true, -- manage and preview opened buffers
|
||||
colorizer = false, -- color RGB, HEX, CSS, NAME color codes
|
||||
comment = true, -- easily (un)comment code, language aware
|
||||
dashboard = false,
|
||||
alpha = false, -- dashboard
|
||||
better_escape = true, -- map to <ESC> with no lag
|
||||
feline = true, -- statusline
|
||||
gitsigns = true,
|
||||
|
@ -95,9 +95,9 @@ M.plugins = {
|
|||
-- hide, show on specific filetypes
|
||||
hidden = {
|
||||
"help",
|
||||
"dashboard",
|
||||
"NvimTree",
|
||||
"terminal",
|
||||
"alpha",
|
||||
},
|
||||
shown = {},
|
||||
|
||||
|
@ -182,14 +182,6 @@ M.mappings.plugins = {
|
|||
toggle = "<leader>/",
|
||||
},
|
||||
|
||||
dashboard = {
|
||||
bookmarks = "<leader>bm",
|
||||
new_file = "<leader>fn", -- basically create a new buffer
|
||||
open = "<leader>db", -- open dashboard
|
||||
session_load = "<leader>l",
|
||||
session_save = "<leader>s",
|
||||
},
|
||||
|
||||
-- map to <ESC> with no lag
|
||||
better_escape = { -- <ESC> will still work
|
||||
esc_insertmode = { "jk" }, -- multiple mappings allowed
|
||||
|
|
|
@ -140,16 +140,6 @@ M.comment = function()
|
|||
map("v", m, ":lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>")
|
||||
end
|
||||
|
||||
M.dashboard = function()
|
||||
local m = plugin_maps.dashboard
|
||||
|
||||
map("n", m.bookmarks, ":DashboardJumpMarks <CR>")
|
||||
map("n", m.new_file, ":DashboardNewFile <CR>")
|
||||
map("n", m.open, ":Dashboard <CR>")
|
||||
map("n", m.session_load, ":SessionLoad <CR>")
|
||||
map("n", m.session_save, ":SessionSave <CR>")
|
||||
end
|
||||
|
||||
M.lspconfig = function()
|
||||
local m = plugin_maps.lspconfig
|
||||
|
||||
|
|
86
lua/plugins/configs/alpha.lua
Normal file
86
lua/plugins/configs/alpha.lua
Normal file
|
@ -0,0 +1,86 @@
|
|||
local present, alpha = pcall(require, "alpha")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local ascii = {
|
||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
}
|
||||
|
||||
local header = {
|
||||
type = "text",
|
||||
val = ascii,
|
||||
opts = {
|
||||
position = "center",
|
||||
hl = "AlphaHeader",
|
||||
},
|
||||
}
|
||||
|
||||
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)
|
||||
vim.api.nvim_feedkeys(key, "normal", false)
|
||||
end,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
local buttons = {
|
||||
type = "group",
|
||||
val = {
|
||||
button("SPC f f", " Find File ", ":Telescope find_files<CR>"),
|
||||
button("SPC f o", " Recent File ", ":Telescope oldfiles<CR>"),
|
||||
button("SPC f w", " Find Word ", ":Telescope live_grep<CR>"),
|
||||
button("SPC b m", " Bookmarks ", ":Telescope marks<CR>"),
|
||||
button("SPC t h", " Themes ", ":Telescope themes<CR>"),
|
||||
button("SPC e s", " Settings", ":e $MYVIMRC | :cd %:p:h <CR>"),
|
||||
},
|
||||
opts = {
|
||||
spacing = 1,
|
||||
},
|
||||
}
|
||||
|
||||
local section = {
|
||||
header = header,
|
||||
buttons = buttons,
|
||||
}
|
||||
|
||||
alpha.setup {
|
||||
layout = {
|
||||
{ type = "padding", val = 5 },
|
||||
section.header,
|
||||
{ type = "padding", val = 2 },
|
||||
section.buttons,
|
||||
},
|
||||
opts = {},
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
local g = vim.g
|
||||
|
||||
g.dashboard_disable_at_vimenter = 0
|
||||
g.dashboard_disable_statusline = 1
|
||||
g.dashboard_default_executive = "telescope"
|
||||
g.dashboard_custom_header = {
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
" ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
" ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
" ⢠⣿⣿⣿⠈ ⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
" ⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
" ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇ ⠛⠻⢷⣄ ",
|
||||
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
" ",
|
||||
}
|
||||
|
||||
g.dashboard_custom_section = {
|
||||
a = { description = { " Find File SPC f f" }, command = "Telescope find_files" },
|
||||
b = { description = { " Recents SPC f o" }, command = "Telescope oldfiles" },
|
||||
c = { description = { " Find Word SPC f w" }, command = "Telescope live_grep" },
|
||||
d = { description = { "洛 New File SPC f n" }, command = "DashboardNewFile" },
|
||||
e = { description = { " Bookmarks SPC b m" }, command = "Telescope marks" },
|
||||
f = { description = { " Load Last Session SPC l " }, command = "SessionLoad" },
|
||||
}
|
||||
|
||||
g.dashboard_custom_footer = {
|
||||
" ",
|
||||
}
|
|
@ -32,7 +32,7 @@ M.blankline = function(override_flag)
|
|||
filetype_exclude = {
|
||||
"help",
|
||||
"terminal",
|
||||
"dashboard",
|
||||
"alpha",
|
||||
"packer",
|
||||
"lspinfo",
|
||||
"TelescopePrompt",
|
||||
|
|
|
@ -182,12 +182,9 @@ local plugins = {
|
|||
},
|
||||
|
||||
{
|
||||
"glepnir/dashboard-nvim",
|
||||
disable = not plugin_settings.status.dashboard,
|
||||
config = override_req("dashboard", "plugins.configs.dashboard"),
|
||||
setup = function()
|
||||
require("core.mappings").dashboard()
|
||||
end,
|
||||
disable = not plugin_settings.status.alpha,
|
||||
"goolord/alpha-nvim",
|
||||
config = override_req("alpha", "plugins.configs.alpha"),
|
||||
},
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue