From 1a18a8ef3036bfd2535fd0f43bb9018c7cdde167 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Fri, 26 Jan 2024 17:21:37 +0100 Subject: [PATCH] icon rework and small refactor --- .config/nvim/lua/config/icons.lua | 237 ++++++------------ .config/nvim/lua/config/keymaps.lua | 20 +- .config/nvim/lua/funcs.lua | 10 +- .config/nvim/lua/plugins/cmp/cmp.lua | 122 --------- .config/nvim/lua/plugins/cmp/init.lua | 4 - .config/nvim/lua/plugins/cmp/luasnip.lua | 47 ---- .config/nvim/lua/plugins/dap/dap.lua | 2 +- .config/nvim/lua/plugins/lazy.lua | 37 ++- .../nvim/lua/plugins/lsp/mason-lspconfig.lua | 16 +- .config/nvim/lua/plugins/lsp/mason.lua | 6 +- .config/nvim/lua/plugins/misc/alpha.lua | 46 +++- .config/nvim/lua/plugins/misc/bufferline.lua | 16 +- .config/nvim/lua/plugins/misc/gitsigns.lua | 12 +- .../lua/plugins/misc/indent-blankline.lua | 18 -- .config/nvim/lua/plugins/misc/lualine.lua | 6 +- .../nvim/lua/plugins/misc/todo-comments.lua | 14 +- .config/nvim/lua/plugins/misc/which-key.lua | 6 +- 17 files changed, 185 insertions(+), 434 deletions(-) delete mode 100644 .config/nvim/lua/plugins/cmp/cmp.lua delete mode 100644 .config/nvim/lua/plugins/cmp/init.lua delete mode 100644 .config/nvim/lua/plugins/cmp/luasnip.lua diff --git a/.config/nvim/lua/config/icons.lua b/.config/nvim/lua/config/icons.lua index 268b33602..f2639c514 100644 --- a/.config/nvim/lua/config/icons.lua +++ b/.config/nvim/lua/config/icons.lua @@ -1,163 +1,80 @@ return { - Diagnostic = "󰒡", - DiagnosticError = "", - DiagnosticHint = "󰌵", - DiagnosticInfo = "󰋼", - DiagnosticWarn = "", - PackageInstalled = "", - PackagePending = "", - PackageUninstalled = "", - Selected = "❯", - - - kind = { - Array = "", - Boolean = "", - Class = "", - Color = "", - Constant = "", - Constructor = "", - Enum = "", - EnumMember = "", - Event = "", - Field = "", - File = "", - Folder = "󰉋", - Function = "", - Interface = "", - Key = "", - Keyword = "", - Method = "", - Module = "", - Namespace = "", - Null = "󰟢", - Number = "", - Object = "", - Operator = "", - Package = "", - Property = "", - Reference = "", - Snippet = "", - String = "", - Struct = "", - Text = "", - TypeParameter = "", - Unit = "", - Value = "", - Variable = "", - }, - git = { - LineAdded = "", - LineModified = "", - LineRemoved = "", - FileDeleted = "", - FileIgnored = "", - FileRenamed = "", - FileStaged = "S", - FileUnmerged = "", - FileUnstaged = "", - FileUntracked = "U", - Diff = "", - Repo = "", - Octoface = "", - Branch = "", - }, - ui = { - ArrowCircleDown = "", - ArrowCircleLeft = "", - ArrowCircleRight = "", - ArrowCircleUp = "", - BoldArrowDown = "", - BoldArrowLeft = "", - BoldArrowRight = "", - BoldArrowUp = "", - BoldClose = "", - BoldDividerLeft = "", - BoldDividerRight = "", - BoldLineLeft = "▎", - BookMark = "", - BoxChecked = "", - Bug = "", - Stacks = " ", - Scopes = "", - Watches = "󰂥", - Debug = "", - Calendar = "", - Check = "", - ChevronRight = ">", - ChevronShortDown = "", - ChevronShortLeft = "", - ChevronShortRight = "", - ChevronShortUp = "", - Circle = "", - Clear = "󰃢", - Close = "󰅖", - CloudDownload = "", - CMD = "", - Code = "", - Comment = "", - Dashboard = "", - DividerLeft = "", - DividerRight = "", - DoubleChevronRight = "󰄾", - DoubleChevronLeft = "󰄽", - Ellipsis = "…", - EmptyFolder = "", - EmptyFolderOpen = "", - EmptyFile = "", - File = "", - Files = "", - FileSymlink = "", - FindFile = "󰈞", - FindText = "󰊄", - Fire = "", - Folder = "󰉋", - FolderOpen = "", - FolderSymlink = "", - Forward = "", - Gear = "", - History = "", - Import = "", - Keyboard = "", - Lightbulb = "", - LineLeft = "▏", - LineMiddle = "│", - List = "", - Lock = "", - MinusCircle = "", - Note = "", - Package = "", - Pencil = "󰏫", - Plus = "", - Project = "", - Search = "", - SignIn = "", - SignOut = "", - Sleep = "󰒲", - Save = "", - Tab = "󰓩", - Table = "", - Target = "", - Telescope = "", - Text = "", - Terminal = "", - Tree = "", - Triangle = "󰐊", - triangleshortarrowdown = "", - triangleshortarrowleft = "", - triangleshortarrowright = "", - triangleshortarrowup = "", - }, + Diagnostic = "󰭷", + Error = "󰅗", + Hint = "󰌵", + Info = "󰋼", + Warn = "󰀦", + Bug = "󰠭", + True = "󰸞", + Pending = "󰁪", + False = "󱎘", + Close = "󱎘", + Selected = "󰅂", + Console = "󰆍", + Gear = "󰒓", + Event = "󱐋", + File = "󰈔", + NewFile = "󰝒", + FileTree = "󰙅", + Import = "󰈠", + Keyboard = "󰌌", + Sleep = "󰒲", + Package = "󰏗", + Runtime = "", + Source = "󰈮", + Code = "", + Start = "", + Task = "󰱒", + Buffer = "󰧭", + Search = "", + Speed = "󰾆", + Test = "", + Flame = "", + Leave = "", + Git = "󰊢", + Loaded = "󰜄", + Unloaded = "󰛲", + Added = "󰜄", + Modified = "󱗝", + Removed = "󰛲", + Untracked = "", + ChangeDelete = "󰅘", + Truncate = "", + -- kind = { + -- Array = "", + -- Boolean = "", + -- Class = "", + -- Color = "", + -- Constant = "", + -- Constructor = "", + -- Enum = "", + -- EnumMember = "", + -- Event = "", + -- Field = "", + -- File = "", + -- Folder = "󰉋", + -- Function = "", + -- Interface = "", + -- Key = "", + -- Keyword = "", + -- Method = "", + -- Module = "", + -- Namespace = "", + -- Null = "󰟢", + -- Number = "", + -- Object = "", + -- Operator = "", + -- Package = "", + -- Property = "", + -- Reference = "", + -- Snippet = "", + -- String = "", + -- Struct = "", + -- Text = "", + -- TypeParameter = "", + -- Unit = "", + -- Value = "", + -- Variable = "", + -- }, -- progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" }, - misc = { - Robot = "󰚩", - Squirrel = "", - Tag = "", - Watch = "", - Smiley = "", - Package = "", - CircuitBoard = "", - Vim = "", - Git = "" - }, } diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index dbebca46f..2b2bef52e 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -3,14 +3,14 @@ local icons = require("config.icons") local maps = f.empty_map_table() local sections = { - p = { desc = " " .. icons.ui.Package .. " Packages" }, - b = { desc = " " .. icons.ui.Tab .. " Buffers" }, - bs = { desc = " " .. icons.ui.Tab .. " Sort Buffers" }, - d = { desc = " " .. icons.ui.Debug .. " Debugger" }, - g = { desc = " " .. icons.misc.Git .. " Git" }, - f = { desc = " " .. icons.ui.Search .. " Find" }, - l = { desc = " " .. icons.ui.Note .. " LSP" }, - t = { desc = " " .. icons.ui.Terminal .. " Terminal" }, + p = { desc = icons.Package .. " Packages" }, + b = { desc = icons.Buffer .. " Buffers" }, + bs = { desc = "Sort Buffers" }, + d = { desc = icons.Bug .. " Debugger" }, + g = { desc = icons.Git .. " Git" }, + f = { desc = icons.Search .. " Find" }, + l = { desc = icons.Code .. " LSP" }, + t = { desc = icons.Console .. " Terminal" }, } -- Standard -- @@ -31,9 +31,6 @@ maps.n["q"] = { f.buf_close, desc = "Close buffer" } maps.n[""] = { "" } maps.n[""] = { "" } maps.i[""] = { "" } --- TODO: Remove this when implemented in lsp_on_attach -maps.n["lf"] = { vim.lsp.buf.format, desc = "Format" } --- TODO: Add compiler script back (or don't tbh) -- Window Navigation -- maps.n[""] = { "h", desc = "Move to left split" } @@ -50,6 +47,7 @@ maps.t[""] = { "wincmd k", desc = "Terminal up window navigation" maps.t[""] = { "wincmd l", desc = "Terminal right window navigation" } -- Plugin Manager -- +maps.n["p"] = sections.p maps.n["ph"] = { function() require("lazy").home() end, desc = "Home" } maps.n["pi"] = { function() require("lazy").install() end, desc = "Install" } maps.n["pu"] = { function() require("lazy").update() end, desc = "Update" } diff --git a/.config/nvim/lua/funcs.lua b/.config/nvim/lua/funcs.lua index 01b6b5592..b1b8d0f1d 100644 --- a/.config/nvim/lua/funcs.lua +++ b/.config/nvim/lua/funcs.lua @@ -250,7 +250,7 @@ function M.lsp_on_attach(client, bufnr) function() vim.lsp.codelens.run() end, desc = "Run CodeLens", } - lsp_mappings.n["u"] = { desc = " " .. icons.ui.Gear .. " Utility" } + lsp_mappings.n["u"] = { desc = " " .. icons.Gear .. " Utility" } lsp_mappings.n["uL"] = { function() vim.lsp.codelens.clear() end, desc = "Toggle CodeLens" @@ -309,7 +309,7 @@ function M.lsp_on_attach(client, bufnr) -- TODO: Check this on 0.10.0 release if client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens then vim.b[bufnr].semantic_tokens_enabled = true - lsp_mappings.n["u"] = { desc = " " .. icons.ui.Gear .. " Utility" } + lsp_mappings.n["u"] = { desc = " " .. icons.Gear .. " Utility" } lsp_mappings.n["uY"] = { function() vim.b[bufnr].semantic_tokens_enabled = not vim.b[bufnr].semantic_tokens_enabled @@ -370,7 +370,7 @@ function M.lsp_on_attach(client, bufnr) -- TODO: Check this on 0.10.0 release if vim.lsp.inlay_hint then if vim.b.inlay_hints_enabled then vim.lsp.inlay_hint.enable(bufnr, true) end - lsp_mappings.n["u"] = { desc = " " .. icons.ui.Gear .. " Utility" } + lsp_mappings.n["u"] = { desc = " " .. icons.Gear .. " Utility" } lsp_mappings.n["uH"] = { function() vim.b[bufnr].inlay_hints_enabled = not vim.b[bufnr].inlay_hints_enabled @@ -423,8 +423,8 @@ function M.lsp_on_attach(client, bufnr) end if not vim.tbl_isempty(lsp_mappings.v) then - if lsp_mappings.v["l"] then lsp_mappings.v["l"] = { desc = " " .. icons.ui.Note .. " LSP" } end - if lsp_mappings.v["u"] then lsp_mappings.v["u"] = { desc = " " .. icons.ui.Note .. " LSP" } end + if lsp_mappings.v["l"] then lsp_mappings.v["l"] = { desc = " " .. icons.Code .. " LSP" } end + if lsp_mappings.v["u"] then lsp_mappings.v["u"] = { desc = " " .. icons.Code .. " LSP" } end end M.set_mappings(lsp_mappings, { buffer = bufnr }) diff --git a/.config/nvim/lua/plugins/cmp/cmp.lua b/.config/nvim/lua/plugins/cmp/cmp.lua deleted file mode 100644 index d96594e83..000000000 --- a/.config/nvim/lua/plugins/cmp/cmp.lua +++ /dev/null @@ -1,122 +0,0 @@ -local M = { "hrsh7th/nvim-cmp" } - -M.dependencies = { - { "onsails/lspkind.nvim" }, - { "saadparwaiz1/cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lsp" }, - { "hrsh7th/cmp-buffer" }, - { "hrsh7th/cmp-path" }, - "LuaSnip", - "nvim-autopairs", -} - -M.event = { "BufReadPost", "BufNewFile" } - -local opts = function() - local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - local cmp_window = require('cmp.utils.window') - cmp_window.info_ = cmp_window.info - cmp_window.info = function(self) - local info = self:info_() - info.scrollable = false - return info - end - - local luasnip = require('luasnip') - local cmp = require('cmp') - - return { - window = { - completion = { - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", - col_offset = -3, - side_padding = 0, - }, - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item) - local strings = vim.split(kind.kind, "%s", { trimempty = true }) - kind.kind = " " .. (strings[1] or "") .. " " - kind.menu = " (" .. (strings[2] or "") .. ")" - - return kind - end, - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping({ - i = function(fallback) - if cmp.visible() and cmp.get_active_entry() then - cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }) - else - fallback() - end - end, - s = cmp.mapping.confirm({ select = true }), - c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), - }), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - experimental = { - ghost_text = true, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - } - } -end - -M.config = function() - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require('cmp') - cmp.setup(opts()) - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) -end - -return M diff --git a/.config/nvim/lua/plugins/cmp/init.lua b/.config/nvim/lua/plugins/cmp/init.lua deleted file mode 100644 index 996eaa4fb..000000000 --- a/.config/nvim/lua/plugins/cmp/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { --- require('plugins.cmp.luasnip'), --- require('plugins.cmp.cmp'), -} diff --git a/.config/nvim/lua/plugins/cmp/luasnip.lua b/.config/nvim/lua/plugins/cmp/luasnip.lua deleted file mode 100644 index 1607c43e6..000000000 --- a/.config/nvim/lua/plugins/cmp/luasnip.lua +++ /dev/null @@ -1,47 +0,0 @@ -local M = { "L3MON4D3/LuaSnip" } - -M.build = "make install_jsregexp" - -local opts = function() - local luasnip = require('luasnip') - local f = luasnip.function_node - return { - history = true, - enable_autosnippets = true, - update_events = { "TextChanged", "TextChangedI" }, - snip_env = { - s = function(...) - local snip = luasnip.s(...) - table.insert(getfenv(2).ls_file_snippets, snip) - end, - parse = function(...) - local snip = luasnip.parser.parse_snippet(...) - table.insert(getfenv(2).ls_file_snippets, snip) - end, - reference = function(node) - return f(function(args, _) return args[1][1] end, node) - end, - capture = function(index) - return f(function(_, snip, user_arg1) return snip.captures[user_arg1] end, nil, { user_args = { index } }) - end - }, - } -end - -M.config = function() - require('luasnip').setup(opts()) - require('luasnip.loaders.from_lua').load({ paths = os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua/snippets" }) - --require('luasnip.loaders.from_vscode').load({ paths = os.getenv("XDG_CONFIG_HOME") .. "/nvim/lua/snippets" }) - vim.api.nvim_create_autocmd("InsertLeave", { - callback = function() - local luasnip = require('luasnip') - if luasnip.session.current_nodes[vim.api.nvim_get_current_buf()] - and not luasnip.session.jump_active - then - luasnip.unlink_current() - end - end, - }) -end - -return M diff --git a/.config/nvim/lua/plugins/dap/dap.lua b/.config/nvim/lua/plugins/dap/dap.lua index d4859fc8b..ff9e10967 100644 --- a/.config/nvim/lua/plugins/dap/dap.lua +++ b/.config/nvim/lua/plugins/dap/dap.lua @@ -13,7 +13,7 @@ M.config = function() vim.fn.sign_define( "DapBreakpoint", { - text = icons.ui.Bug, + text = icons.Bug, texthl = "DiagnosticSignError", linehl = "", numhl = "", diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index d524fc79d..a0c11bc07 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -1,32 +1,25 @@ local M = { "folke/lazy.nvim" } - local icons = require('config.icons') M.opts = { ui = { border = "single", icons = { - cmd = icons.ui.CMD .. " ", - config = icons.ui.Gear, - event = icons.misc.Bolt, - ft = icons.ui.File .. " ", - init = icons.ui.Gear .. " ", - import = icons.ui.Import .. " ", - keys = icons.ui.Keyboard .. " ", - lazy = icons.ui.Sleep .. " ", - loaded = icons.ui.CircleFull, - not_loaded = icons.ui.CircleEmpty, - plugin = icons.misc.Package, - runtime = icons.misc.Vim .. " ", - source = icons.ui.Code .. " ", - start = icons.ui.Start, - task = icons.ui.Check .. " ", - list = { - icons.ui.CircleFull, - icons.ui.BoldArrowRight, - icons.misc.Star, - icons.ui.LineHorizontal, - }, + cmd = icons.Console .. " ", + config = icons.Gear, + event = icons.Event, + ft = icons.File .. " ", + init = icons.Gear .. " ", + import = icons.Import .. " ", + keys = icons.Keyboard .. " ", + lazy = icons.Sleep .. " ", + loaded = icons.Loaded, + not_loaded = icons.Unloaded, + plugin = icons.Package, + runtime = icons.Runtime .. " ", + source = icons.Source .. " ", + start = icons.Start, + task = icons.Task, }, }, } diff --git a/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua b/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua index aa2be5119..d3e0cf334 100644 --- a/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua +++ b/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua @@ -28,10 +28,10 @@ M.cmd = { "LspInstall", "LspUninstall" } M.config = function() local icons = require("config.icons") local signs = { - { name = "DiagnosticSignError", text = icons.DiagnosticError, texthl = "DiagnosticSignError" }, - { name = "DiagnosticSignWarn", text = icons.DiagnosticWarn, texthl = "DiagnosticSignWarn" }, - { name = "DiagnosticSignHint", text = icons.DiagnosticHint, texthl = "DiagnosticSignHint" }, - { name = "DiagnosticSignInfo", text = icons.DiagnosticInfo, texthl = "DiagnosticSignInfo" }, + { name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticSignError" }, + { name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticSignWarn" }, + { name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticSignHint" }, + { name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticSignInfo" }, { name = "DapStopped", text = icons.DapStopped, texthl = "DiagnosticWarn" }, { name = "DapBreakpoint", text = icons.DapBreakpoint, texthl = "DiagnosticInfo" }, { name = "DapBreakpointRejected", text = icons.DapBreakpointRejected, texthl = "DiagnosticError" }, @@ -46,10 +46,10 @@ M.config = function() virtual_text = true, signs = { text = { - [vim.diagnostic.severity.ERROR] = icons.DiagnosticError, - [vim.diagnostic.severity.HINT] = icons.DiagnosticHint, - [vim.diagnostic.severity.WARN] = icons.DiagnosticWarn, - [vim.diagnostic.severity.INFO] = icons.DiagnosticInfo, + [vim.diagnostic.severity.ERROR] = icons.Error, + [vim.diagnostic.severity.HINT] = icons.Hint, + [vim.diagnostic.severity.WARN] = icons.Warn, + [vim.diagnostic.severity.INFO] = icons.Info, }, active = signs, }, diff --git a/.config/nvim/lua/plugins/lsp/mason.lua b/.config/nvim/lua/plugins/lsp/mason.lua index 540806596..f8d58db4e 100644 --- a/.config/nvim/lua/plugins/lsp/mason.lua +++ b/.config/nvim/lua/plugins/lsp/mason.lua @@ -17,9 +17,9 @@ M.opts = { ui = { border = "none", icons = { - package_installed = icons.PackageInstalled, - package_pending = icons.PackagePending, - package_uninstalled = icons.PackageUninstalled, + package_installed = icons.True, + package_pending = icons.Pending, + package_uninstalled = icons.False, }, }, log_level = vim.log.levels.INFO, diff --git a/.config/nvim/lua/plugins/misc/alpha.lua b/.config/nvim/lua/plugins/misc/alpha.lua index 3ec617823..a0c0a106f 100644 --- a/.config/nvim/lua/plugins/misc/alpha.lua +++ b/.config/nvim/lua/plugins/misc/alpha.lua @@ -1,8 +1,11 @@ local M = { "goolord/alpha-nvim" } -local icons = require('config.icons') M.opts = function() - local dashboard = require('alpha.themes.dashboard') + local icons = require("config.icons") + local dashboard = require("alpha.themes.dashboard") + + dashboard.section.header.opts.hl = "DashboardHeader" + dashboard.section.footer.opts.hl = "DashboardFooter" local banner = { "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀", @@ -36,19 +39,42 @@ M.opts = function() dashboard.section.header.val = banner dashboard.section.buttons.val = { - dashboard.button("n", icons.ui.EmptyFile .. " New file", "ene"), - dashboard.button("e", icons.ui.FindFile .. " Open file", "Lf"), - dashboard.button("q", icons.ui.SignOut .. " Quit", "qa"), + dashboard.button("n", icons.File .. " New file", "ene"), + dashboard.button("f", icons.Search .. " Find file", ":lua require('telescope.builtin').find_files()"), + dashboard.button("e", icons.FileTree .. " Browse files", "Lf"), + dashboard.button("q", icons.Leave .. " Quit", "qa"), } dashboard.section.footer.val = "Behold: a Snail's Vim" - dashboard.section.footer.opts.hl = "Type" - dashboard.section.header.opts.hl = "Include" - dashboard.section.buttons.opts.hl = "Keyword" + dashboard.config.layout = { + { type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } }, + dashboard.section.header, + { type = "padding", val = 5 }, + dashboard.section.buttons, + { type = "padding", val = 3 }, + dashboard.section.footer, + } - -- dashboard.opts.opts.noautocmd = true - return dashboard.opts + dashboard.config.opts.noautocmd = true + + return dashboard +end + +M.config = function(_, opts) + require("alpha").setup(opts.config) + + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + desc = "Add Alpha dashboard footer", + once = true, + callback = function() + local stats = require("lazy").stats() + local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 + opts.section.footer.val = { stats.count .. "  " .. ms .. "ms" } + pcall(vim.cmd.AlphaRedraw) + end, + }) end return M diff --git a/.config/nvim/lua/plugins/misc/bufferline.lua b/.config/nvim/lua/plugins/misc/bufferline.lua index 5d9eb16f1..5f5245615 100644 --- a/.config/nvim/lua/plugins/misc/bufferline.lua +++ b/.config/nvim/lua/plugins/misc/bufferline.lua @@ -8,9 +8,9 @@ M.opts = function() local function diagnostics_indicator(_, _, diagnostics, _) local result = {} local symbols = { - error = icons.DiagnosticError, - warning = icons.DiagnosticWarning, - info = icons.DiagnosticInformation, + error = icons.Error, + warning = icons.Warn, + info = icons.Info, } for name, count in pairs(diagnostics) do if symbols[name] and count > 0 then @@ -36,11 +36,11 @@ M.opts = function() indicator = { style = "none", }, - buffer_close_icon = icons.ui.Close, - modified_icon = icons.ui.Circle, - close_icon = icons.ui.BoldClose, - left_trunc_marker = icons.ui.ArrowCircleLeft, - right_trunc_marker = icons.ui.ArrowCircleRight, + buffer_close_icon = icons.Close, + modified_icon = icons.Modified, + close_icon = icons.Close, + left_trunc_marker = icons.Truncate, + right_trunc_marker = icons.Truncate, diagnostics = "nvim_lsp", diagnostics_indicator = diagnostics_indicator, offsets = {}, diff --git a/.config/nvim/lua/plugins/misc/gitsigns.lua b/.config/nvim/lua/plugins/misc/gitsigns.lua index 7dc63decb..72ddd33b9 100644 --- a/.config/nvim/lua/plugins/misc/gitsigns.lua +++ b/.config/nvim/lua/plugins/misc/gitsigns.lua @@ -6,12 +6,12 @@ local icons = require('config.icons') M.opts = { signs = { - add = { text = icons.git.LineAdded }, - change = { text = icons.git.LineModified }, - delete = { text = icons.git.LineRemoved }, - topdelete = { text = icons.git.LineRemoved }, - changedelete = { text = icons.git.FileRenamed }, - untracked = { text = icons.git.FileIgnored }, + add = { text = icons.Added }, + change = { text = icons.Modified }, + delete = { text = icons.Removed }, + topdelete = { text = icons.Removed }, + changedelete = { text = icons.ChangeDelete }, + untracked = { text = icons.Untracked }, }, } diff --git a/.config/nvim/lua/plugins/misc/indent-blankline.lua b/.config/nvim/lua/plugins/misc/indent-blankline.lua index 9fbb6e9bd..53e367271 100644 --- a/.config/nvim/lua/plugins/misc/indent-blankline.lua +++ b/.config/nvim/lua/plugins/misc/indent-blankline.lua @@ -4,24 +4,6 @@ M.main = "ibl" M.event = { "BufReadPost", "BufNewFile" } --- FIX: This keybind is broken and should be moved to config/keymaps.lua --- M.keys = { --- { --- "", --- function() --- local ok, start = require("indent_blankline.utils").get_current_context( --- vim.g.indent_blankline_context_patterns, --- vim.g.indent_blankline_use_treesitter_scope --- ) --- if ok then --- vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) --- vim.cmd [[normal! _]] --- end --- end, --- desc = "Jump to context", --- }, --- } - M.dependencies = { "nvim-treesitter", } diff --git a/.config/nvim/lua/plugins/misc/lualine.lua b/.config/nvim/lua/plugins/misc/lualine.lua index 9091a3d84..b5bd6480e 100644 --- a/.config/nvim/lua/plugins/misc/lualine.lua +++ b/.config/nvim/lua/plugins/misc/lualine.lua @@ -179,9 +179,9 @@ M.opts = function() 'diagnostics', sources = { 'nvim_diagnostic' }, symbols = { - error = icons.DiagnosticError .. ' ', - warn = icons.DiagnosticWarn .. ' ', - info = icons.DiagnosticInfo .. ' ', + error = icons.Error .. ' ', + warn = icons.Warn .. ' ', + info = icons.Info .. ' ', }, diagnostics_color = { color_error = { fg = colors.red }, diff --git a/.config/nvim/lua/plugins/misc/todo-comments.lua b/.config/nvim/lua/plugins/misc/todo-comments.lua index 7acd7f4f7..4d4e37c82 100644 --- a/.config/nvim/lua/plugins/misc/todo-comments.lua +++ b/.config/nvim/lua/plugins/misc/todo-comments.lua @@ -1,11 +1,19 @@ local M = { "folke/todo-comments.nvim" } +local icons = require('config.icons') M.event = { "BufReadPost", "BufNewFile" } M.config = { - highlight = { - multiline = false - } + signs = false, + keywords = { + BUG = { icon = icons.Bug, color = "error", alt = { "FIXME", "FIX", "FIXIT", "ISSUE" } }, + TODO = { icon = icons.Task, color = "info" }, + HACK = { icon = icons.Flame, color = "warning" }, + WARN = { icon = icons.Warn, color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = icons.Speed, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = icons.Buffer, color = "hint", alt = { "INFO" } }, + TEST = { icon = icons.Test, color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/which-key.lua b/.config/nvim/lua/plugins/misc/which-key.lua index 09ecfd297..676fc6d91 100644 --- a/.config/nvim/lua/plugins/misc/which-key.lua +++ b/.config/nvim/lua/plugins/misc/which-key.lua @@ -17,9 +17,9 @@ M.opts = { } }, icons = { - breadcrumb = icons.ui.DoubleChevronRight, - separator = icons.ui.BoldArrowRight, - group = icons.ui.Plus, + breadcrumb = icons.Selected, + separator = icons.Selected, + group = icons.Buffer .. "", }, hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, triggers = "auto",