From cbd72735a229d7a330142352c15873b9e31ea39c Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Tue, 9 Jan 2024 11:46:35 -0500 Subject: [PATCH 1/6] Add bufferline This time around, bufferline has settings added to make it not overlap NeoTree and to look right with my theme set to a transparent background. --- .../files/nvim/lua/config/vim-options.lua | 1 + .../files/nvim/lua/disabled/bufferline.lua | 7 --- .../files/nvim/lua/plugins/bufferline.lua | 49 +++++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) delete mode 100644 modules/home-manager/files/nvim/lua/disabled/bufferline.lua create mode 100644 modules/home-manager/files/nvim/lua/plugins/bufferline.lua diff --git a/modules/home-manager/files/nvim/lua/config/vim-options.lua b/modules/home-manager/files/nvim/lua/config/vim-options.lua index f45637f..730517d 100644 --- a/modules/home-manager/files/nvim/lua/config/vim-options.lua +++ b/modules/home-manager/files/nvim/lua/config/vim-options.lua @@ -19,3 +19,4 @@ vim.keymap.set("n", "h", ":nohlsearch") vim.wo.relativenumber = true +vim.o.termguicolors = true diff --git a/modules/home-manager/files/nvim/lua/disabled/bufferline.lua b/modules/home-manager/files/nvim/lua/disabled/bufferline.lua deleted file mode 100644 index eff1628..0000000 --- a/modules/home-manager/files/nvim/lua/disabled/bufferline.lua +++ /dev/null @@ -1,7 +0,0 @@ -return{ - "akinsho/bufferline.nvim", - version = "*", - dependencies = "nvim-tree/nvim-web-devicons", - event = "BufReadPre", - config = true -} diff --git a/modules/home-manager/files/nvim/lua/plugins/bufferline.lua b/modules/home-manager/files/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..3c2bc72 --- /dev/null +++ b/modules/home-manager/files/nvim/lua/plugins/bufferline.lua @@ -0,0 +1,49 @@ +return { + "akinsho/bufferline.nvim", + after = "catppuccin", + dependencies = { "nvim-tree/nvim-web-devicons" }, + version = "*", + config = function() + -- Get the color pallet of the theme flavor I am using + local color_palette = require("catppuccin.palettes").get_palette("frappe") + + -- Set variables to use the color they'd use if the background was not transparent + local bg_highlight = color_palette.crust + local separator_fg = color_palette.crust + + require("bufferline").setup({ + highlights = require("catppuccin.groups.integrations.bufferline").get({ + -- Copy settings from Catppuccin bufferline integration and override just the + -- part that is needed to make it look like it would if the background was not + -- set to transparent in catppuccin.lua + -- https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/bufferline.lua + custom = { + all = { + -- this makes the background behind the tabs contrast with the tabs themselves + fill = { bg = bg_highlight }, + + -- separators + -- I am only overriding the foreground as that is what makes the tabs look correct + separator = { fg = separator_fg }, + separator_visible = { fg = separator_fg }, + separator_selected = { fg = separator_fg }, + offset_separator = { fg = separator_fg }, + }, + }, + }), + options = { + mode = "buffers", + separator_style = "slant", + offsets = { + { + filetype = "neo-tree", + text = "File Explorer", + highlight = "Directory", + separator = true, + }, + }, + diagnostics = "nvim_lsp", + }, + }) + end, +} From 6d16e8bdb7bfdd77e81ff0f8f0032325103d6466 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Tue, 9 Jan 2024 11:47:46 -0500 Subject: [PATCH 2/6] Add noice for the popup cmdline window --- .../files/nvim/lua/plugins/noice.lua | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 modules/home-manager/files/nvim/lua/plugins/noice.lua diff --git a/modules/home-manager/files/nvim/lua/plugins/noice.lua b/modules/home-manager/files/nvim/lua/plugins/noice.lua new file mode 100644 index 0000000..cdd3c45 --- /dev/null +++ b/modules/home-manager/files/nvim/lua/plugins/noice.lua @@ -0,0 +1,61 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + -- "rcarriga/nvim-notify", + }, + config = function() + require("noice").setup({ + cmdline = { enabled = true }, + messages = { enabled = false }, + + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + + views = { + cmdline_popup = { + position = { + row = "50%", + col = "50%", + }, + size = { + width = 60, + height = "auto", + }, + }, + popupmenu = { + relative = "editor", + position = { + row = "61%", + col = "50%", + }, + size = { + width = 60, + height = 10, + }, + border = { + style = "rounded", + padding = { 0, 1 }, + }, + win_options = { + winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" }, + }, + }, + }, + }) + end, +} From d43eb64a46081d1bcb4e46990413ad57bee59b82 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Tue, 9 Jan 2024 12:11:35 -0500 Subject: [PATCH 3/6] Make NeoTree show even when Alpha is open --- modules/home-manager/files/nvim/lua/plugins/alpha.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/home-manager/files/nvim/lua/plugins/alpha.lua b/modules/home-manager/files/nvim/lua/plugins/alpha.lua index d6638ae..61c763e 100644 --- a/modules/home-manager/files/nvim/lua/plugins/alpha.lua +++ b/modules/home-manager/files/nvim/lua/plugins/alpha.lua @@ -27,5 +27,7 @@ return { } alpha.setup(dashboard.opts) + + vim.cmd('autocmd User AlphaReady Neotree show') end, } From 376bec3e002e221c43c3739fe6726fc2fa9b4e95 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Tue, 9 Jan 2024 17:26:02 -0500 Subject: [PATCH 4/6] Added toggleterm and edgy Edgy makes for a better sidebar and toggleterm make getting a shell really easy --- .../files/nvim/lua/config/vim-options.lua | 9 +++ .../files/nvim/lua/plugins/edgy.lua | 65 +++++++++++++++++++ .../files/nvim/lua/plugins/neo-tree.lua | 4 -- .../files/nvim/lua/plugins/toggleterm.lua | 5 ++ 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 modules/home-manager/files/nvim/lua/plugins/edgy.lua create mode 100644 modules/home-manager/files/nvim/lua/plugins/toggleterm.lua diff --git a/modules/home-manager/files/nvim/lua/config/vim-options.lua b/modules/home-manager/files/nvim/lua/config/vim-options.lua index 730517d..f004b05 100644 --- a/modules/home-manager/files/nvim/lua/config/vim-options.lua +++ b/modules/home-manager/files/nvim/lua/config/vim-options.lua @@ -20,3 +20,12 @@ vim.keymap.set("n", "h", ":nohlsearch") vim.wo.relativenumber = true vim.o.termguicolors = true + +-- Tips from https://github.com/folke/edgy.nvim +-- views can only be fully collapsed with the global statusline +vim.opt.laststatus = 3 + +-- Default splitting will cause your main splits to jump when opening an edgebar. +-- To prevent this, set `splitkeep` to either `screen` or `topline`. +vim.opt.splitkeep = "screen" + diff --git a/modules/home-manager/files/nvim/lua/plugins/edgy.lua b/modules/home-manager/files/nvim/lua/plugins/edgy.lua new file mode 100644 index 0000000..27b5193 --- /dev/null +++ b/modules/home-manager/files/nvim/lua/plugins/edgy.lua @@ -0,0 +1,65 @@ +return { + "folke/edgy.nvim", + event = "VeryLazy", + opts = { + exit_when_last = true, + bottom = { + -- toggleterm / lazyterm at the bottom with a height of 40% of the screen + { + ft = "toggleterm", + size = { height = 0.2 }, + -- exclude floating windows + filter = function(buf, win) + return vim.api.nvim_win_get_config(win).relative == "" + end, + }, + "Trouble", + { ft = "qf", title = "QuickFix" }, + { + ft = "help", + size = { height = 20 }, + -- only show help buffers + filter = function(buf) + return vim.bo[buf].buftype == "help" + end, + }, + { ft = "spectre_panel", size = { height = 0.4 } }, + }, + left = { + -- Neo-tree filesystem always takes half the screen height + { + title = "Neo-Tree", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "filesystem" + end, + size = { height = 0.5 }, + }, + { + title = "Neo-Tree Git", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "git_status" + end, + pinned = true, + open = "Neotree position=right git_status", + }, + { + title = "Neo-Tree Buffers", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "buffers" + end, + pinned = true, + open = "Neotree position=top buffers", + }, + { + ft = "Outline", + pinned = true, + open = "SymbolsOutlineOpen", + }, + -- any other neo-tree windows + "neo-tree", + }, + }, +} diff --git a/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua b/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua index bb2b2d1..ad2938c 100644 --- a/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua +++ b/modules/home-manager/files/nvim/lua/plugins/neo-tree.lua @@ -19,10 +19,6 @@ return { hijack_netrw_behavior = "open_default", }, follow_current_file = { enabled = true }, - source_selector = { - winbar = true, - statusline = false, - }, }) end, } diff --git a/modules/home-manager/files/nvim/lua/plugins/toggleterm.lua b/modules/home-manager/files/nvim/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..22121c0 --- /dev/null +++ b/modules/home-manager/files/nvim/lua/plugins/toggleterm.lua @@ -0,0 +1,5 @@ +return { + "akinsho/toggleterm.nvim", + version = "*", + config = true, +} From 4758cdc96ad9ed0bb152208886312b79e3f3d181 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Wed, 10 Jan 2024 20:37:41 -0500 Subject: [PATCH 5/6] Make line numbers easier to read --- modules/home-manager/files/nvim/lua/plugins/catppuccin.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua b/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua index 84d7e45..ce011c5 100644 --- a/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua +++ b/modules/home-manager/files/nvim/lua/plugins/catppuccin.lua @@ -18,6 +18,7 @@ return { custom_highlights = function(colors) return { Comment = { fg = colors.subtext0 }, + LineNr = { fg = colors.subtext0 }, } end, }) From 192b92df0d445eeb54d6e4c44c51eb7825323b2d Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Wed, 10 Jan 2024 20:38:05 -0500 Subject: [PATCH 6/6] Add XML bits --- modules/home-manager/files/nvim/lua/plugins/lsp-config.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua b/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua index 7d17dcc..8958daf 100644 --- a/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua +++ b/modules/home-manager/files/nvim/lua/plugins/lsp-config.lua @@ -8,6 +8,7 @@ return { config = function() require("mason-lspconfig").setup({ ensure_installed = { + "lemminx", -- xml "lua_ls", -- lua "nil_ls", -- nix "puppet", -- puppet @@ -32,6 +33,11 @@ return { local lspconfig = require("lspconfig") local capabilities = require("cmp_nvim_lsp").default_capabilities() + lspconfig.lemminx.setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + lspconfig.lua_ls.setup({ capabilities = capabilities, on_attach = on_attach,