refactor: move everything under lazyvim
This commit is contained in:
122
lua/lazyvim/plugins/ui.lua
Normal file
122
lua/lazyvim/plugins/ui.lua
Normal file
@ -0,0 +1,122 @@
|
||||
return {
|
||||
-- better vim.notify
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
init = function()
|
||||
vim.notify = function(...)
|
||||
vim.notify = require("notify")
|
||||
return vim.notify(...)
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- better vim.ui
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- bufferline
|
||||
{
|
||||
"akinsho/nvim-bufferline.lua",
|
||||
event = "BufAdd",
|
||||
config = true,
|
||||
},
|
||||
|
||||
-- statusline
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
config = {
|
||||
options = {
|
||||
globalstatus = true,
|
||||
disabled_filetypes = { statusline = { "lazy", "alpha" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- indent guides for Neovim
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "BufReadPre",
|
||||
config = {
|
||||
char = "▏",
|
||||
},
|
||||
},
|
||||
|
||||
-- noicer ui
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
config = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true,
|
||||
command_palette = true,
|
||||
long_message_to_split = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- dashboard
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
local logo = [[
|
||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " " .. " Find file", ":Telescope find_files <CR>"),
|
||||
dashboard.button("n", " " .. " New file", ":ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles <CR>"),
|
||||
dashboard.button("g", " " .. " Find text", ":Telescope live_grep <CR>"),
|
||||
dashboard.button("c", " " .. " Config", ":e $MYVIMRC <CR>"),
|
||||
dashboard.button("l", "鈴" .. " Lazy", ":Lazy<CR>"),
|
||||
dashboard.button("q", " " .. " Quit", ":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
|
||||
|
||||
if vim.o.filetype == "lazy" then
|
||||
-- close and re-open Lazy after showing alpha
|
||||
vim.notify("Missing plugins installed!", vim.log.levels.INFO, { title = "lazy.nvim" })
|
||||
vim.cmd.close()
|
||||
require("alpha").setup(dashboard.opts)
|
||||
require("lazy").show()
|
||||
else
|
||||
require("alpha").setup(dashboard.opts)
|
||||
end
|
||||
|
||||
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,
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user