refactor(ui): moved mini.starter to extras
This commit is contained in:
73
lua/lazyvim/plugins/extras/ui/mini-starter.lua
Normal file
73
lua/lazyvim/plugins/extras/ui/mini-starter.lua
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
-- start screen
|
||||||
|
return {
|
||||||
|
-- disable alpha
|
||||||
|
{ "goolord/alpha-nvim", enabled = false },
|
||||||
|
|
||||||
|
-- enable mini.starter
|
||||||
|
{
|
||||||
|
"echasnovski/mini.starter",
|
||||||
|
version = false, -- wait till new 0.7.0 release to put it back on semver
|
||||||
|
event = "VimEnter",
|
||||||
|
opts = function()
|
||||||
|
local logo = table.concat({
|
||||||
|
"██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z",
|
||||||
|
"██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z",
|
||||||
|
"██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z",
|
||||||
|
"██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z",
|
||||||
|
"███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║",
|
||||||
|
"╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
|
||||||
|
}, "\n")
|
||||||
|
local pad = string.rep(" ", 22)
|
||||||
|
local new_section = function(name, action, section)
|
||||||
|
return { name = name, action = action, section = pad .. section }
|
||||||
|
end
|
||||||
|
|
||||||
|
local starter = require("mini.starter")
|
||||||
|
--stylua: ignore
|
||||||
|
local config = {
|
||||||
|
evaluate_single = true,
|
||||||
|
header = logo,
|
||||||
|
items = {
|
||||||
|
new_section("Find file", "Telescope find_files", "Telescope"),
|
||||||
|
new_section("Recent files", "Telescope oldfiles", "Telescope"),
|
||||||
|
new_section("Grep text", "Telescope live_grep", "Telescope"),
|
||||||
|
new_section("init.lua", "e $MYVIMRC", "Config"),
|
||||||
|
new_section("Lazy", "Lazy", "Config"),
|
||||||
|
new_section("New file", "ene | startinsert", "Built-in"),
|
||||||
|
new_section("Quit", "qa", "Built-in"),
|
||||||
|
},
|
||||||
|
content_hooks = {
|
||||||
|
starter.gen_hook.adding_bullet(pad .. "░ ", false),
|
||||||
|
starter.gen_hook.aligning("center", "center"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
end,
|
||||||
|
config = function(_, config)
|
||||||
|
-- close Lazy and re-open when starter is ready
|
||||||
|
if vim.o.filetype == "lazy" then
|
||||||
|
vim.cmd.close()
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "MiniStarterOpened",
|
||||||
|
callback = function()
|
||||||
|
require("lazy").show()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local starter = require("mini.starter")
|
||||||
|
starter.setup(config)
|
||||||
|
|
||||||
|
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)
|
||||||
|
local pad_footer = string.rep(" ", 8)
|
||||||
|
starter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
|
||||||
|
pcall(starter.refresh)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -210,72 +210,6 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- start screen
|
|
||||||
{
|
|
||||||
"echasnovski/mini.starter",
|
|
||||||
enabled = false,
|
|
||||||
version = false, -- wait till new 0.7.0 release to put it back on semver
|
|
||||||
event = "VimEnter",
|
|
||||||
config = function()
|
|
||||||
local logo = table.concat({
|
|
||||||
"██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z",
|
|
||||||
"██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z",
|
|
||||||
"██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z",
|
|
||||||
"██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z",
|
|
||||||
"███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║",
|
|
||||||
"╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝",
|
|
||||||
}, "\n")
|
|
||||||
local pad = string.rep(" ", 22)
|
|
||||||
local new_section = function(name, action, section)
|
|
||||||
return { name = name, action = action, section = pad .. section }
|
|
||||||
end
|
|
||||||
|
|
||||||
local starter = require("mini.starter")
|
|
||||||
--stylua: ignore
|
|
||||||
local config = {
|
|
||||||
evaluate_single = true,
|
|
||||||
header = logo,
|
|
||||||
items = {
|
|
||||||
new_section("Find file", "Telescope find_files", "Telescope"),
|
|
||||||
new_section("Recent files", "Telescope oldfiles", "Telescope"),
|
|
||||||
new_section("Grep text", "Telescope live_grep", "Telescope"),
|
|
||||||
new_section("init.lua", "e $MYVIMRC", "Config"),
|
|
||||||
new_section("Lazy", "Lazy", "Config"),
|
|
||||||
new_section("New file", "ene | startinsert", "Built-in"),
|
|
||||||
new_section("Quit", "qa", "Built-in"),
|
|
||||||
},
|
|
||||||
content_hooks = {
|
|
||||||
starter.gen_hook.adding_bullet(pad .. "░ ", false),
|
|
||||||
starter.gen_hook.aligning("center", "center"),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- close Lazy and re-open when starter is ready
|
|
||||||
if vim.o.filetype == "lazy" then
|
|
||||||
vim.cmd.close()
|
|
||||||
vim.api.nvim_create_autocmd("User", {
|
|
||||||
pattern = "MiniStarterOpened",
|
|
||||||
callback = function()
|
|
||||||
require("lazy").show()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
starter.setup(config)
|
|
||||||
|
|
||||||
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)
|
|
||||||
local pad_footer = string.rep(" ", 8)
|
|
||||||
MiniStarter.config.footer = pad_footer .. "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms"
|
|
||||||
pcall(MiniStarter.refresh)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- dashboard
|
-- dashboard
|
||||||
{
|
{
|
||||||
"goolord/alpha-nvim",
|
"goolord/alpha-nvim",
|
||||||
|
Reference in New Issue
Block a user