{ lib, config, ... }: { options = { bufferline = { enable = lib.mkEnableOption "Enable bufferline module"; keymaps = { enable = lib.mkOption { type = lib.types.bool; default = true; description = "Enable default keymaps"; }; enableHL = lib.mkOption { type = lib.types.bool; default = true; description = "Enable keymaps for switching buffers with h and l"; }; enableTab = lib.mkOption { type = lib.types.bool; default = true; description = "Enable keymaps for switching buffers with Tab and S-Tab"; }; }; }; }; config = let cfg = config.bufferline; in lib.mkIf cfg.enable { plugins = { bufferline = { enable = true; settings = { options = { separatorStyle = "thick"; # “slant”, “padded_slant”, “slope”, “padded_slope”, “thick”, “thin“ offsets = [ { filetype = "neo-tree"; text = "Neo-tree"; highlight = "Directory"; text_align = "left"; } ]; }; }; }; }; keymaps = lib.mkIf cfg.keymaps.enable ([ { mode = "n"; key = "bd"; action = "bdelete"; options = { desc = "Delete buffer"; }; } { mode = "n"; key = "bb"; action = "e #"; options = { desc = "Switch to Other Buffer"; }; } # { # mode = "n"; # key = "`"; # action = "e #"; # options = { # desc = "Switch to Other Buffer"; # }; # } { mode = "n"; key = "br"; action = "BufferLineCloseRight"; options = { desc = "Delete buffers to the right"; }; } { mode = "n"; key = "bl"; action = "BufferLineCloseLeft"; options = { desc = "Delete buffers to the left"; }; } { mode = "n"; key = "bo"; action = "BufferLineCloseOthers"; options = { desc = "Delete other buffers"; }; } { mode = "n"; key = "bp"; action = "BufferLineTogglePin"; options = { desc = "Toggle pin"; }; } { mode = "n"; key = "bP"; action = "BufferLineGroupClose ungrouped"; options = { desc = "Delete non-pinned buffers"; }; } ] ++ (lib.optionals cfg.keymaps.enableTab [ { mode = "n"; key = ""; action = "BufferLineCycleNext"; options = { desc = "Cycle to next buffer"; }; } { mode = "n"; key = ""; action = "BufferLineCyclePrev"; options = { desc = "Cycle to previous buffer"; }; } ]) ++ (lib.optionals cfg.keymaps.enableHL [ { mode = "n"; key = ""; action = "BufferLineCycleNext"; options = { desc = "Cycle to next buffer"; }; } { mode = "n"; key = ""; action = "BufferLineCyclePrev"; options = { desc = "Cycle to previous buffer"; }; } ])); }; }