-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
cursorline.nix
56 lines (48 loc) · 1.48 KB
/
cursorline.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
let
cfg = config.plugins.cursorline;
in
{
options.plugins.cursorline = helpers.neovim-plugin.extraOptionsOptions // {
enable = mkEnableOption "nvim-cursorline";
package = helpers.mkPluginPackageOption "nvim-cursorline" pkgs.vimPlugins.nvim-cursorline;
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.";
};
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 {
underline = true;
} "Highliht definition map for cursorword highlighting.";
};
};
config =
let
options = {
cursorline = with cfg.cursorline; {
inherit enable timeout number;
};
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(${helpers.toLuaObject options})
'';
};
}