dashboard
This commit is contained in:
parent
27272c7e77
commit
ee5ce89ad8
2 changed files with 64 additions and 5 deletions
|
@ -1,5 +1,4 @@
|
|||
return {
|
||||
|
||||
{ -- use bdelete instead
|
||||
"https://github.com/famiu/bufdelete.nvim",
|
||||
config = function()
|
||||
|
@ -14,6 +13,7 @@ return {
|
|||
local fallback_on_empty = fallback_name == "" and fallback_ft == ""
|
||||
if fallback_on_empty then
|
||||
require("neo-tree").close_all()
|
||||
vim.cmd("Alpha")
|
||||
vim.cmd(event.buf .. "bwipeout")
|
||||
end
|
||||
end,
|
||||
|
@ -24,7 +24,6 @@ return {
|
|||
{ "<leader>bD", "<CMD>Bdelete!<CR>", desc = "delete buffer!" },
|
||||
},
|
||||
},
|
||||
|
||||
{ -- neo-tree file explorer
|
||||
"https://github.com/nvim-neo-tree/neo-tree.nvim",
|
||||
cmd = "Neotree",
|
||||
|
@ -125,7 +124,6 @@ return {
|
|||
telescope.load_extension("notify")
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- a fast motion inside a visible area
|
||||
"https://github.com/ggandor/leap.nvim",
|
||||
event = "BufReadPre",
|
||||
|
@ -143,7 +141,6 @@ return {
|
|||
buffer_leader_key = '<leader>h',
|
||||
}
|
||||
},
|
||||
|
||||
{ -- displays a popup with possible key bindings
|
||||
"https://github.com/folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
|
@ -155,11 +152,13 @@ return {
|
|||
spec = {
|
||||
{ "<leader>b", group = "buffer" },
|
||||
{ "<leader>g", group = "git" },
|
||||
{ "<leader>gd", group = "diff" },
|
||||
{ "<leader>gr", group = "reset" },
|
||||
{ "<leader>gs", group = "stage" },
|
||||
{ "<leader>gt", group = "toggle" },
|
||||
{ "<leader>t", group = "telescope" },
|
||||
{ "<leader>u", group = "ui" },
|
||||
{ "<leader>x", group = "diagnostics" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -245,5 +244,4 @@ return {
|
|||
event = "BufReadPost",
|
||||
config = true,
|
||||
},
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,65 @@
|
|||
return {
|
||||
{ -- dashboard
|
||||
-- https://github.com/goolord/alpha-nvim/discussions/16
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
opts = function()
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
local logo = [[
|
||||
███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗
|
||||
████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║
|
||||
██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║
|
||||
██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║
|
||||
██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " " .. " Find file", "<CMD>Telescope find_files <CR>"),
|
||||
dashboard.button("n", " " .. " New file", "<CMD>ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("r", " " .. " Recent files", "<CMD>Telescope oldfiles <CR>"),
|
||||
dashboard.button("g", " " .. " Find text", "<CMD>Telescope live_grep <CR>"),
|
||||
dashboard.button("l", " " .. " Lazy", "<CMD>Lazy<CR>"),
|
||||
dashboard.button("q", " " .. " Quit", "<CMD>qa<CR>"),
|
||||
}
|
||||
for _, button in ipairs(dashboard.section.buttons.val) do
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
end
|
||||
dashboard.section.footer.opts.hl = "Type"
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
dashboard.opts.layout[1].val = 8
|
||||
return dashboard
|
||||
end,
|
||||
config = function(_, dashboard)
|
||||
vim.b.miniindentscope_disable = true
|
||||
|
||||
-- close Lazy and re-open when the dashboard is ready
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.cmd.close()
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "AlphaReady",
|
||||
callback = function()
|
||||
require("lazy").show()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
require("alpha").setup(dashboard.opts)
|
||||
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "LazyVimStarted",
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- notification popups
|
||||
"https://github.com/rcarriga/nvim-notify",
|
||||
|
|
Loading…
Reference in a new issue