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 {
vim = {
startPlugins = [
"nvim-bufferline-lua"
"bufferline-nvim"
"bufdelete-nvim"
];

View file

@ -3,7 +3,7 @@
lib,
...
}: 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.generators) mkLuaInline;
inherit (lib.nvim.binds) mkMappingOption;
@ -24,17 +24,28 @@ in {
movePrevious = mkMappingOption "Move previous buffer" "<leader>bmp";
};
setupOpts = mkPluginSetupOption "Bufferline-nvim" {
setupOpts = mkPluginSetupOption "bufferline-nvim" {
highlights = mkOption {
type = either attrs luaInline;
default =
if config.vim.theme.enable && config.vim.theme.name == "catppuccin"
then
mkLuaInline
''
require("catppuccin.groups.integrations.bufferline").get()
mkLuaInline ''
(function()
local integration = require("catppuccin.groups.integrations.bufferline")
return (integration.get_theme or integration.get)()
end)()
''
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 = ''
Overrides the highlight groups of bufferline.
@ -59,10 +70,11 @@ in {
themable = mkOption {
type = bool;
default = true;
example = false;
description = ''
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.
'';
};