From 621ed6051637f0c09ba81f0502e8de17871a03bb Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 11 May 2023 18:03:39 +0100 Subject: [PATCH] Add alpha Update catppuccin integrations Fix lsp hover from noice filter Fix broken treesitter config --- home/tui/config/nvim/lua/plugins/alpha.lua | 57 +++++++++++++++++++ .../config/nvim/lua/plugins/catppuccin.lua | 14 ++--- home/tui/config/nvim/lua/plugins/noice.lua | 4 +- .../config/nvim/lua/plugins/nvim_navbuddy.lua | 18 +++++- .../tui/config/nvim/lua/plugins/telescope.lua | 6 +- .../config/nvim/lua/plugins/treesitter.lua | 15 ++++- 6 files changed, 98 insertions(+), 16 deletions(-) create mode 100644 home/tui/config/nvim/lua/plugins/alpha.lua diff --git a/home/tui/config/nvim/lua/plugins/alpha.lua b/home/tui/config/nvim/lua/plugins/alpha.lua new file mode 100644 index 00000000..650d148e --- /dev/null +++ b/home/tui/config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,57 @@ +return { + "goolord/alpha-nvim", + event = "VimEnter", + opts = 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 "), + dashboard.button("n", " " .. " New file", ":ene startinsert "), + dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles "), + dashboard.button("g", "󰊢 " .. " Git status", ":Neogit kind=floating "), + dashboard.button("c", " " .. " Config", ":e $MYVIMRC "), + 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, +} diff --git a/home/tui/config/nvim/lua/plugins/catppuccin.lua b/home/tui/config/nvim/lua/plugins/catppuccin.lua index 99392d83..db42dfc4 100644 --- a/home/tui/config/nvim/lua/plugins/catppuccin.lua +++ b/home/tui/config/nvim/lua/plugins/catppuccin.lua @@ -3,11 +3,7 @@ local config = { term_colors = true, transparent_background = true, integrations = { - barbar = true, - barbecue = { - dim_dirname = true, - }, - dashboard = true, + alpha = true, gitsigns = true, hop = true, indent_blankline = { @@ -15,15 +11,17 @@ local config = { colored_indent_levels = true, }, cmp = true, - mason = true, + markdown = true, + mini = true, native_lsp = { enabled = true, }, neogit = true, + neotree = true, + noice = true, notify = true, - nvimtree = true, navic = { - enabled = false, + enabled = true, custom_bg = "NONE", }, treesitter = true, diff --git a/home/tui/config/nvim/lua/plugins/noice.lua b/home/tui/config/nvim/lua/plugins/noice.lua index 50fcfa8a..28dbfc64 100644 --- a/home/tui/config/nvim/lua/plugins/noice.lua +++ b/home/tui/config/nvim/lua/plugins/noice.lua @@ -30,8 +30,8 @@ return { win_options = { winblend = 0 }, }, }, - status = { lsp = { event = "lsp" } }, - routes = { { view = "mini", filter = { event = "lsp" }, opts = { skip = true } } }, + status = { lsp = { event = "lsp", kind = "progress" } }, + routes = { { view = "mini", filter = { event = "lsp", kind = "progress" }, opts = { skip = true } } }, -- you can enable a preset for easier configuration presets = { bottom_search = false, -- use a classic bottom cmdline for search diff --git a/home/tui/config/nvim/lua/plugins/nvim_navbuddy.lua b/home/tui/config/nvim/lua/plugins/nvim_navbuddy.lua index f332322c..680aea9d 100644 --- a/home/tui/config/nvim/lua/plugins/nvim_navbuddy.lua +++ b/home/tui/config/nvim/lua/plugins/nvim_navbuddy.lua @@ -6,6 +6,22 @@ return { config = true, opts = { icons = require "ui.navic_icons", - window = { border = "rounded" }, + window = { + border = "none", + size = "80%", + sections = { + left = { border = "rounded" }, + mid = { border = "rounded" }, + right = { border = "rounded", preview = "always" }, + }, + }, + node_markers = { + enabled = true, + icons = { + leaf = " ", + leaf_selected = " → ", + branch = " ", + }, + }, }, } diff --git a/home/tui/config/nvim/lua/plugins/telescope.lua b/home/tui/config/nvim/lua/plugins/telescope.lua index ab80cd0c..f9b78b46 100644 --- a/home/tui/config/nvim/lua/plugins/telescope.lua +++ b/home/tui/config/nvim/lua/plugins/telescope.lua @@ -21,13 +21,13 @@ return { init = function() vim.keymap.set("n", ";", "Telescope builtin") vim.keymap.set("n", "ff", "Telescope find_files") + vim.keymap.set("n", "fr", "Telescope oldfiles") vim.keymap.set("n", "fg", "Telescope live_grep") vim.keymap.set("n", "fb", "Telescope buffers") - vim.keymap.set("n", "fl", "Telescope lsp_document_symbols") + vim.keymap.set("n", "fs", "Telescope lsp_document_symbols") vim.keymap.set("n", "fe", "Telescope diagnostics") - vim.keymap.set("n", "fs", "Telescope treesitter") + vim.keymap.set("n", "ft", "Telescope treesitter") vim.keymap.set("n", "fz", "Telescope current_buffer_fuzzy_find") - vim.keymap.set("n", "fp", "Telescope projects") end, config = function() local trouble = require "trouble.providers.telescope" diff --git a/home/tui/config/nvim/lua/plugins/treesitter.lua b/home/tui/config/nvim/lua/plugins/treesitter.lua index e9aa4bd0..8b64d3d8 100644 --- a/home/tui/config/nvim/lua/plugins/treesitter.lua +++ b/home/tui/config/nvim/lua/plugins/treesitter.lua @@ -10,9 +10,20 @@ return { "TSUpdate", "TSEnable", }, - config = true, + config = function(_, opts) + if type(opts.ensure_installed) == "table" then + -- @type table + local added = {} + opts.ensure_installed = vim.tbl_filter(function(lang) + if added[lang] then return false end + added[lang] = true + return true + end, opts.ensure_installed) + end + require("nvim-treesitter.configs").setup(opts) + end, opts = { - ensure_installed = { "vim", "regex", "lua", "bash", "markdown", "markdown_inline"}, + ensure_installed = { "vim", "regex", "lua", "bash", "markdown", "markdown_inline" }, auto_install = false, highlight = { enable = true,