visuals: move nvim-scrollbar to its own module; switch to setupOpts

This commit is contained in:
NotAShelf 2024-10-07 00:30:18 +03:00
parent db54345de1
commit 95b09bc3a4
No known key found for this signature in database
GPG key ID: AF26552424E53993
7 changed files with 67 additions and 35 deletions

View file

@ -1278,6 +1278,22 @@
"type": "github"
}
},
"plugin-nvim-scrollbar": {
"flake": false,
"locked": {
"lastModified": 1717406282,
"narHash": "sha256-Y5qCD2pjfs9fodH9Y1waefVuj/m33kx4ExMmAa/qoP4=",
"owner": "petertriho",
"repo": "nvim-scrollbar",
"rev": "d09f14aa16c9f2748e77008f9da7b1f76e4e7b85",
"type": "github"
},
"original": {
"owner": "petertriho",
"repo": "nvim-scrollbar",
"type": "github"
}
},
"plugin-nvim-session-manager": {
"flake": false,
"locked": {
@ -1534,22 +1550,6 @@
"type": "github"
}
},
"plugin-scrollbar-nvim": {
"flake": false,
"locked": {
"lastModified": 1684886154,
"narHash": "sha256-zLBexSxQCn9HPY04a9w/UCJP1F5ShI2X12I9xE9H0cM=",
"owner": "petertriho",
"repo": "nvim-scrollbar",
"rev": "35f99d559041c7c0eff3a41f9093581ceea534e8",
"type": "github"
},
"original": {
"owner": "petertriho",
"repo": "nvim-scrollbar",
"type": "github"
}
},
"plugin-smartcolumn": {
"flake": false,
"locked": {
@ -1920,6 +1920,7 @@
"plugin-nvim-neoclip": "plugin-nvim-neoclip",
"plugin-nvim-nio": "plugin-nvim-nio",
"plugin-nvim-notify": "plugin-nvim-notify",
"plugin-nvim-scrollbar": "plugin-nvim-scrollbar",
"plugin-nvim-session-manager": "plugin-nvim-session-manager",
"plugin-nvim-surround": "plugin-nvim-surround",
"plugin-nvim-tree-lua": "plugin-nvim-tree-lua",
@ -1936,7 +1937,6 @@
"plugin-registers": "plugin-registers",
"plugin-rose-pine": "plugin-rose-pine",
"plugin-rustaceanvim": "plugin-rustaceanvim",
"plugin-scrollbar-nvim": "plugin-scrollbar-nvim",
"plugin-smartcolumn": "plugin-smartcolumn",
"plugin-sqls-nvim": "plugin-sqls-nvim",
"plugin-tabular": "plugin-tabular",

View file

@ -418,7 +418,7 @@
flake = false;
};
plugin-scrollbar-nvim = {
plugin-nvim-scrollbar = {
url = "github:petertriho/nvim-scrollbar";
flake = false;
};

View file

@ -19,23 +19,6 @@ in {
'';
})
(mkIf cfg.scrollBar.enable {
vim.startPlugins = ["scrollbar-nvim"];
vim.pluginRC.scrollBar = entryAnywhere ''
require('scrollbar').setup{
excluded_filetypes = {
'prompt',
'TelescopePrompt',
'noice',
'NvimTree',
'alpha',
'notify',
'Navbuddy'
},
}
'';
})
(mkIf cfg.smoothScroll.enable {
vim.startPlugins = ["cinnamon-nvim"];
vim.pluginRC.smoothScroll = entryAnywhere ''

View file

@ -2,6 +2,7 @@
imports = [
./fidget
./nvim-cursorline
./nvim-scrollbar
./nvim-web-devicons
./config.nix

View file

@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.visuals.nvim-scrollbar;
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["nvim-scrollbar"];
pluginRC.cursorline = entryAnywhere ''
require("scrollbar").setup(${toLuaObject cfg.setupOpts})
'';
};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./config.nix
./scrollbar-nvim.nix
];
}

View file

@ -0,0 +1,21 @@
{lib, ...}: let
inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.types) listOf str;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
imports = [
(mkRenamedOptionModule ["vim" "visuals" "scrollBar"] ["vim" "visuals" "nvim-scrollbar"])
];
options.vim.visuals.nvim-scrollbar = {
enable = mkEnableOption "extensible Neovim Scrollbar [nvim-scrollbar]";
setupOpts = mkPluginSetupOption "scrollbar-nvim" {
excluded_filetypes = mkOption {
type = listOf str;
default = ["prompt" "TelescopePrompt" "noice" "noice" "NvimTree" "neo-tree" "alpha" "notify" "Navbuddy"];
description = "Filetypes to hide the scrollbar on";
};
};
};
}