From cbd72735a229d7a330142352c15873b9e31ea39c Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Tue, 9 Jan 2024 11:46:35 -0500 Subject: [PATCH] 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, +}