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,
|
||||
helpers,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.cursorline;
|
||||
inherit (lib.nixvim) defaultNullOpts;
|
||||
inherit (lib) types;
|
||||
in
|
||||
{
|
||||
options.plugins.cursorline = lib.nixvim.plugins.neovim.extraOptionsOptions // {
|
||||
enable = mkEnableOption "nvim-cursorline";
|
||||
lib.nixvim.plugins.mkNeovimPlugin {
|
||||
name = "cursorline";
|
||||
moduleName = "nvim-cursorline";
|
||||
packPathName = "nvim-cursorline";
|
||||
package = "nvim-cursorline";
|
||||
|
||||
package = lib.mkPackageOption pkgs "nvim-cursorline" {
|
||||
default = [
|
||||
"vimPlugins"
|
||||
"nvim-cursorline"
|
||||
];
|
||||
};
|
||||
maintainers = [ lib.maintainers.khaneliman ];
|
||||
|
||||
description = ''
|
||||
A Neovim plugin to highlight the cursor line and word under the cursor.
|
||||
'';
|
||||
|
||||
settingsOptions = {
|
||||
cursorline = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Show / hide cursorline in connection with cursor moving.";
|
||||
|
||||
timeout = helpers.defaultNullOpts.mkInt 1000 "Time (in ms) after which the cursorline appears.";
|
||||
|
||||
number = helpers.defaultNullOpts.mkBool false "Whether to also highlight the line number.";
|
||||
enable = defaultNullOpts.mkBool true "Show / hide cursorline in connection with cursor moving.";
|
||||
timeout = defaultNullOpts.mkInt 1000 "Time (in ms) after which the cursorline appears.";
|
||||
number = defaultNullOpts.mkBool false "Whether to also highlight the line number.";
|
||||
};
|
||||
cursorword = {
|
||||
enable = helpers.defaultNullOpts.mkBool true "Underlines the word under the cursor.";
|
||||
|
||||
minLength = helpers.defaultNullOpts.mkInt 3 "Minimum length for underlined words.";
|
||||
|
||||
hl = helpers.defaultNullOpts.mkAttrsOf types.anything {
|
||||
enable = defaultNullOpts.mkBool true "Underlines the word under the cursor.";
|
||||
min_length = defaultNullOpts.mkInt 3 "Minimum length for underlined words.";
|
||||
hl = defaultNullOpts.mkAttrsOf types.anything {
|
||||
underline = true;
|
||||
} "Highliht definition map for cursorword highlighting.";
|
||||
} "Highlight definition map for cursorword highlighting.";
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
options = {
|
||||
cursorline = with cfg.cursorline; {
|
||||
inherit enable timeout number;
|
||||
settingsExample = {
|
||||
settings = {
|
||||
cursorline = {
|
||||
enable = true;
|
||||
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,6 +7,7 @@
|
|||
plugins.cursorline = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
cursorline = {
|
||||
enable = true;
|
||||
timeout = 1000;
|
||||
|
@ -14,11 +15,12 @@
|
|||
};
|
||||
cursorword = {
|
||||
enable = true;
|
||||
minLength = 3;
|
||||
min_length = 3;
|
||||
hl = {
|
||||
underline = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue