From b853ea2f6af779da8e8611ae22759c78631bea88 Mon Sep 17 00:00:00 2001 From: Dinesh Salunke Date: Wed, 5 Jul 2023 07:52:50 +0530 Subject: [PATCH] refactor: lualine config udpates --- lua/plugins/ui.lua | 77 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 7bd7996..2d1e02a 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -5,12 +5,31 @@ return { "nvim-tree/nvim-web-devicons", }, opts = { + options = { + theme = "auto", + globalstatus = true, + disabled_filetypes = { + statusline = { + "dashboard", + "alpha", + }, + }, + }, sections = { lualine_a = { "mode", }, lualine_b = { "branch", "diff", "diagnostics" }, - lualine_c = { { "filename", path = 1 } }, + lualine_c = { + { "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } }, + { + "filename", + path = 1, + symbols = { + modified = require("config.icons").FileModified, + }, + }, + }, }, }, }, @@ -106,4 +125,60 @@ return { "rcarriga/nvim-notify", opts = {}, }, + + { + "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", ":Telescope find_files "), + dashboard.button("n", " " .. " New file", ":ene startinsert "), + dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles "), + dashboard.button("g", " " .. " Find text", ":Telescope live_grep "), + dashboard.button("c", " " .. " Config", ":e $MYVIMRC "), + dashboard.button("s", " " .. " Restore Session", [[:lua require("persistence").load() ]]), + dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy"), + dashboard.button("q", " " .. " Quit", ":qa"), + } + for _, button in ipairs(dashboard.section.buttons.val) do + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + end + dashboard.section.header.opts.hl = "AlphaHeader" + dashboard.section.buttons.opts.hl = "AlphaButtons" + dashboard.section.footer.opts.hl = "AlphaFooter" + dashboard.opts.layout[1].val = 8 + return dashboard + end, + config = function(_, dashboard) + -- 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, + }, }