mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
plugins/cursorline: migrate to mkNeovimPlugin
This commit is contained in:
parent
ccd0092988
commit
3aabd32181
3 changed files with 78 additions and 53 deletions
|
@ -1,61 +1,55 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.plugins.cursorline;
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
inherit (lib) types;
|
||||||
in
|
in
|
||||||
{
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
options.plugins.cursorline = lib.nixvim.plugins.neovim.extraOptionsOptions // {
|
name = "cursorline";
|
||||||
enable = mkEnableOption "nvim-cursorline";
|
moduleName = "nvim-cursorline";
|
||||||
|
packPathName = "nvim-cursorline";
|
||||||
|
package = "nvim-cursorline";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "nvim-cursorline" {
|
maintainers = [ lib.maintainers.khaneliman ];
|
||||||
default = [
|
|
||||||
"vimPlugins"
|
|
||||||
"nvim-cursorline"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
A Neovim plugin to highlight the cursor line and word under the cursor.
|
||||||
|
'';
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
cursorline = {
|
cursorline = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true "Show / hide cursorline in connection with cursor moving.";
|
enable = defaultNullOpts.mkBool true "Show / hide cursorline in connection with cursor moving.";
|
||||||
|
timeout = defaultNullOpts.mkInt 1000 "Time (in ms) after which the cursorline appears.";
|
||||||
timeout = helpers.defaultNullOpts.mkInt 1000 "Time (in ms) after which the cursorline appears.";
|
number = defaultNullOpts.mkBool false "Whether to also highlight the line number.";
|
||||||
|
|
||||||
number = helpers.defaultNullOpts.mkBool false "Whether to also highlight the line number.";
|
|
||||||
};
|
};
|
||||||
cursorword = {
|
cursorword = {
|
||||||
enable = helpers.defaultNullOpts.mkBool true "Underlines the word under the cursor.";
|
enable = defaultNullOpts.mkBool true "Underlines the word under the cursor.";
|
||||||
|
min_length = defaultNullOpts.mkInt 3 "Minimum length for underlined words.";
|
||||||
minLength = helpers.defaultNullOpts.mkInt 3 "Minimum length for underlined words.";
|
hl = defaultNullOpts.mkAttrsOf types.anything {
|
||||||
|
|
||||||
hl = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
|
||||||
underline = true;
|
underline = true;
|
||||||
} "Highliht definition map for cursorword highlighting.";
|
} "Highlight definition map for cursorword highlighting.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
settingsExample = {
|
||||||
let
|
settings = {
|
||||||
options = {
|
cursorline = {
|
||||||
cursorline = with cfg.cursorline; {
|
enable = true;
|
||||||
inherit enable timeout number;
|
timeout = 1000;
|
||||||
|
number = false;
|
||||||
|
};
|
||||||
|
cursorword = {
|
||||||
|
enable = true;
|
||||||
|
min_length = 3;
|
||||||
|
hl = {
|
||||||
|
underline = true;
|
||||||
};
|
};
|
||||||
cursorword = with cfg.cursorword; {
|
};
|
||||||
inherit enable;
|
|
||||||
min_length = minLength;
|
|
||||||
inherit hl;
|
|
||||||
};
|
|
||||||
} // cfg.extraOptions;
|
|
||||||
in
|
|
||||||
mkIf cfg.enable {
|
|
||||||
extraPlugins = [ cfg.package ];
|
|
||||||
|
|
||||||
extraConfigLua = ''
|
|
||||||
require('nvim-cursorline').setup(${lib.nixvim.toLuaObject options})
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Deprecated in 2025-02-01
|
||||||
|
inherit (import ./deprecations.nix) deprecateExtraOptions optionsRenamedToSettings;
|
||||||
}
|
}
|
||||||
|
|
29
plugins/by-name/cursorline/deprecations.nix
Normal file
29
plugins/by-name/cursorline/deprecations.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
deprecateExtraOptions = true;
|
||||||
|
optionsRenamedToSettings = [
|
||||||
|
[
|
||||||
|
"cursorline"
|
||||||
|
"enable"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"cursorline"
|
||||||
|
"timeout"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"cursorline"
|
||||||
|
"number"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"cursorword"
|
||||||
|
"enable"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"cursorword"
|
||||||
|
"minLength"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"cursorword"
|
||||||
|
"hl"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
|
@ -7,16 +7,18 @@
|
||||||
plugins.cursorline = {
|
plugins.cursorline = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
cursorline = {
|
settings = {
|
||||||
enable = true;
|
cursorline = {
|
||||||
timeout = 1000;
|
enable = true;
|
||||||
number = false;
|
timeout = 1000;
|
||||||
};
|
number = false;
|
||||||
cursorword = {
|
};
|
||||||
enable = true;
|
cursorword = {
|
||||||
minLength = 3;
|
enable = true;
|
||||||
hl = {
|
min_length = 3;
|
||||||
underline = true;
|
hl = {
|
||||||
|
underline = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue