mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 18:31:35 +00:00
modules/visuals: migrate plugins to setupOpts
This commit is contained in:
parent
b3f51048db
commit
a6bb6e1b3e
28 changed files with 692 additions and 396 deletions
21
modules/plugins/visuals/nvim-cursorline/config.nix
Normal file
21
modules/plugins/visuals/nvim-cursorline/config.nix
Normal 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-cursorline;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-cursorline"];
|
||||
|
||||
pluginRC.nvim-cursorline = entryAnywhere ''
|
||||
require("nvim-cursorline").setup(${toLuaObject cfg.setupOpts})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/visuals/nvim-cursorline/default.nix
Normal file
6
modules/plugins/visuals/nvim-cursorline/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-cursorline.nix
|
||||
];
|
||||
}
|
65
modules/plugins/visuals/nvim-cursorline/nvim-cursorline.nix
Normal file
65
modules/plugins/visuals/nvim-cursorline/nvim-cursorline.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.modules) mkRenamedOptionModule mkRemovedOptionModule;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) int bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
imports = [
|
||||
(mkRenamedOptionModule ["vim" "visuals" "cursorline"] ["vim" "visuals" "nvim-cursorline"])
|
||||
(mkRenamedOptionModule ["vim" "visuals" "nvim-cursorline" "lineTimeout"] ["vim" "visuals" "nvim-cursorline" "setupOpts" "line_timeout"])
|
||||
(mkRemovedOptionModule ["vim" "visuals" "nvim-cursorline" "lineNumbersOnly"] ''
|
||||
`vim.visuals.nvim-cursorline.lineNumbersOnly` has been removed. Use `vim.visuals.nvim-cursorline.number` instead.
|
||||
'')
|
||||
];
|
||||
|
||||
options.vim.visuals.nvim-cursorline = {
|
||||
enable = mkEnableOption "cursor word and line highlighting [nvim-cursorline]";
|
||||
|
||||
# Upstream has **zero** documentation whatsoever. I'm making wild assumptions
|
||||
# on what goes into description based don the source code. I'm sorry. Not.
|
||||
setupOpts = mkPluginSetupOption "nvim-cursorline" {
|
||||
cursorline = {
|
||||
enable = mkEnableOption "cursor line highlighting";
|
||||
timeout = mkOption {
|
||||
type = int;
|
||||
default = 1000;
|
||||
description = "Cursorline timeout";
|
||||
};
|
||||
|
||||
number = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = ''
|
||||
If true, `vim.wo.cursorlineopt` will be set to "number"
|
||||
when the trigger conditions are met.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
cursorword = {
|
||||
enable = mkEnableOption "cursor word highlighting";
|
||||
timeout = mkOption {
|
||||
type = int;
|
||||
default = 1000;
|
||||
description = "Cursorword timeout";
|
||||
};
|
||||
|
||||
min_length = mkOption {
|
||||
type = int;
|
||||
default = 3;
|
||||
description = ''
|
||||
The min_length option defines the minimum number of characters
|
||||
a word must have to be highlighted as a "cursor word." Any word
|
||||
shorter than this value will be ignored and not highlighted.
|
||||
'';
|
||||
};
|
||||
|
||||
hl.underline = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to underline matching cursorword";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue