nvim-bufferline: fix catppuccin integration

Handle breaking changes gracefully for once, ffs

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69647fc9d590ec3cb0cee53e4e6ae2f88de5
This commit is contained in:
raf 2025-08-31 19:25:35 +03:00
commit 7592797325
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 19 additions and 7 deletions

View file

@ -15,7 +15,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = [ startPlugins = [
"nvim-bufferline-lua" "bufferline-nvim"
"bufdelete-nvim" "bufdelete-nvim"
]; ];

View file

@ -3,7 +3,7 @@
lib, lib,
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.options) mkOption mkEnableOption literalExpression literalMD;
inherit (lib.types) enum bool either nullOr str int listOf attrs; inherit (lib.types) enum bool either nullOr str int listOf attrs;
inherit (lib.generators) mkLuaInline; inherit (lib.generators) mkLuaInline;
inherit (lib.nvim.binds) mkMappingOption; inherit (lib.nvim.binds) mkMappingOption;
@ -24,17 +24,28 @@ in {
movePrevious = mkMappingOption "Move previous buffer" "<leader>bmp"; movePrevious = mkMappingOption "Move previous buffer" "<leader>bmp";
}; };
setupOpts = mkPluginSetupOption "Bufferline-nvim" { setupOpts = mkPluginSetupOption "bufferline-nvim" {
highlights = mkOption { highlights = mkOption {
type = either attrs luaInline; type = either attrs luaInline;
default = default =
if config.vim.theme.enable && config.vim.theme.name == "catppuccin" if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
then then
mkLuaInline mkLuaInline ''
'' (function()
require("catppuccin.groups.integrations.bufferline").get() local integration = require("catppuccin.groups.integrations.bufferline")
return (integration.get_theme or integration.get)()
end)()
'' ''
else {}; else {};
defaultText = literalMD ''
```lua
(function()
local integration = require("catppuccin.groups.integrations.bufferline")
return (integration.get_theme or integration.get)()
end)()
```
if the active theme is Catppuccin, `{}` otherwise.
'';
description = '' description = ''
Overrides the highlight groups of bufferline. Overrides the highlight groups of bufferline.
@ -59,10 +70,11 @@ in {
themable = mkOption { themable = mkOption {
type = bool; type = bool;
default = true; default = true;
example = false;
description = '' description = ''
Whether or not to allow highlight groups to be overridden. Whether or not to allow highlight groups to be overridden.
While false, bufferline.nvim sets highlights as default. While `false`, bufferline.nvim sets highlights as default.
''; '';
}; };