modules/tabline: switch to explicit lib calls

This commit is contained in:
NotAShelf 2024-03-12 03:47:41 +03:00
parent 32c2e7733a
commit e80f2c9280
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
4 changed files with 86 additions and 82 deletions

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./nvim-bufferline
];

View file

@ -3,13 +3,14 @@
lib,
...
}: let
inherit (lib) mkIf mkMerge mkLuaBinding mkBinding nvim pushDownDefault;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.binds) mkLuaBinding mkBinding pushDownDefault;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.tabline.nvimBufferline;
self = import ./nvim-bufferline.nix {
inherit lib;
};
mappings = self.options.vim.tabline.nvimBufferline.mappings;
self = import ./nvim-bufferline.nix {inherit lib;};
inherit (self.options.vim.tabline.nvimBufferline) mappings;
in {
config = mkIf cfg.enable (
let
@ -22,12 +23,13 @@ in {
'';
};
in {
vim.startPlugins = [
(assert config.vim.visuals.nvimWebDevicons.enable == true; "nvim-bufferline-lua")
vim = {
startPlugins = [
(assert config.vim.visuals.nvimWebDevicons.enable; "nvim-bufferline-lua")
"bufdelete-nvim"
];
vim.maps.normal = mkMerge [
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)
@ -40,14 +42,14 @@ in {
(mkBinding cfg.mappings.movePrevious ":BufferLineMovePrev<CR>" mappings.movePrevious.description)
];
vim.binds.whichKey.register = pushDownDefault {
binds.whichKey.register = pushDownDefault {
"<leader>b" = "+Buffer";
"<leader>bm" = "BufferLineMove";
"<leader>bs" = "BufferLineSort";
"<leader>bsi" = "BufferLineSortById";
};
vim.luaConfigRC.nvimBufferline = nvim.dag.entryAnywhere ''
luaConfigRC.nvimBufferline = entryAnywhere ''
require("bufferline").setup{
options = {
mode = "buffers",
@ -98,6 +100,7 @@ in {
}
}
'';
};
}
);
}

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./nvim-bufferline.nix
./config.nix

View file

@ -1,8 +1,9 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkMappingOption;
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.tabline.nvimBufferline = {
enable = mkEnableOption "nvim-bufferline-lua as a bufferline";
enable = mkEnableOption "neovim bufferline";
mappings = {
closeCurrent = mkMappingOption "Close buffer" null;