2023-02-01 19:11:37 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-03-12 00:47:41 +00:00
|
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
|
|
inherit (lib.nvim.binds) mkLuaBinding mkBinding pushDownDefault;
|
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-04-26 23:25:55 +00:00
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-02-01 19:11:37 +00:00
|
|
|
cfg = config.vim.tabline.nvimBufferline;
|
2024-03-12 00:47:41 +00:00
|
|
|
self = import ./nvim-bufferline.nix {inherit lib;};
|
|
|
|
inherit (self.options.vim.tabline.nvimBufferline) mappings;
|
2023-02-01 19:11:37 +00:00
|
|
|
in {
|
2024-04-26 23:25:55 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim = {
|
|
|
|
startPlugins = [
|
2024-11-08 09:59:08 +00:00
|
|
|
"nvim-bufferline-lua"
|
2024-04-26 23:25:55 +00:00
|
|
|
"bufdelete-nvim"
|
|
|
|
];
|
2023-02-01 19:11:37 +00:00
|
|
|
|
2024-11-08 09:59:08 +00:00
|
|
|
# Soft-dependency for bufferline.
|
|
|
|
# Recommended by upstream, so enabled here.
|
|
|
|
visuals.nvim-web-devicons.enable = true;
|
|
|
|
|
2024-06-14 09:20:10 +00:00
|
|
|
maps.normal = mkMerge [
|
|
|
|
(mkLuaBinding cfg.mappings.closeCurrent "require(\"bufdelete\").bufdelete" mappings.closeCurrent.description)
|
|
|
|
(mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext<CR>" mappings.cycleNext.description)
|
|
|
|
(mkBinding cfg.mappings.cycleNext ":BufferLineCycleNext<CR>" mappings.cycleNext.description)
|
|
|
|
(mkBinding cfg.mappings.cyclePrevious ":BufferLineCyclePrev<CR>" mappings.cyclePrevious.description)
|
|
|
|
(mkBinding cfg.mappings.pick ":BufferLinePick<CR>" mappings.pick.description)
|
|
|
|
(mkBinding cfg.mappings.sortByExtension ":BufferLineSortByExtension<CR>" mappings.sortByExtension.description)
|
|
|
|
(mkBinding cfg.mappings.sortByDirectory ":BufferLineSortByDirectory<CR>" mappings.sortByDirectory.description)
|
|
|
|
(mkLuaBinding cfg.mappings.sortById "function() require(\"bufferline\").sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end) end" mappings.sortById.description)
|
|
|
|
(mkBinding cfg.mappings.moveNext ":BufferLineMoveNext<CR>" mappings.moveNext.description)
|
|
|
|
(mkBinding cfg.mappings.movePrevious ":BufferLineMovePrev<CR>" mappings.movePrevious.description)
|
|
|
|
];
|
|
|
|
|
2024-04-26 23:25:55 +00:00
|
|
|
binds.whichKey.register = pushDownDefault {
|
|
|
|
"<leader>b" = "+Buffer";
|
|
|
|
"<leader>bm" = "BufferLineMove";
|
|
|
|
"<leader>bs" = "BufferLineSort";
|
|
|
|
"<leader>bsi" = "BufferLineSortById";
|
2024-03-12 00:47:41 +00:00
|
|
|
};
|
2024-04-26 23:25:55 +00:00
|
|
|
|
2024-07-20 08:30:48 +00:00
|
|
|
pluginRC.nvimBufferline = entryAnywhere ''
|
2024-06-16 17:56:31 +00:00
|
|
|
require("bufferline").setup(${toLuaObject cfg.setupOpts})
|
2024-04-26 23:25:55 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-02-01 19:11:37 +00:00
|
|
|
}
|