mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition. The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix. For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
140 lines
3.3 KiB
Nix
140 lines
3.3 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.plugins.specs;
|
|
helpers = import ../helpers.nix { inherit lib; };
|
|
in
|
|
{
|
|
options.plugins.specs = {
|
|
enable = mkEnableOption "Enable specs-nvim";
|
|
|
|
show_jumps = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
min_jump = mkOption {
|
|
type = types.int;
|
|
default = 30;
|
|
};
|
|
|
|
delay = mkOption {
|
|
type = types.int;
|
|
default = 0;
|
|
description = "Delay in miliseconds";
|
|
};
|
|
|
|
increment = mkOption {
|
|
type = types.int;
|
|
default = 10;
|
|
description = "Increment in miliseconds";
|
|
};
|
|
|
|
blend = mkOption {
|
|
type = types.int;
|
|
default = 10;
|
|
};
|
|
|
|
width = mkOption {
|
|
type = types.int;
|
|
default = 10;
|
|
};
|
|
|
|
fader = mkOption {
|
|
type = types.submodule {
|
|
options = {
|
|
builtin = mkOption {
|
|
type = types.nullOr (types.enum [
|
|
"linear_fader"
|
|
"exp_fader"
|
|
"pulse_fader"
|
|
"empty_fader"
|
|
]);
|
|
default = "linear_fader";
|
|
};
|
|
|
|
custom = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
example = ''
|
|
function(blend, cnt)
|
|
if cnt > 100 then
|
|
return 80
|
|
else return nil end
|
|
end
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
default = { builtin = "linear_fader"; };
|
|
};
|
|
|
|
resizer = mkOption {
|
|
type = types.submodule {
|
|
options = {
|
|
builtin = mkOption {
|
|
type = types.nullOr
|
|
(types.enum [ "shrink_resizer" "slide_resizer" "empty_resizer" ]);
|
|
default = "shrink_resizer";
|
|
};
|
|
|
|
custom = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
example = ''
|
|
function(width, ccol, cnt)
|
|
if width-cnt > 0 then
|
|
return {width+cnt, ccol}
|
|
else return nil end
|
|
end
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
default = { builtin = "shrink_resizer"; };
|
|
};
|
|
|
|
ignored_filetypes = mkOption {
|
|
type = with types; listOf string;
|
|
default = [ ];
|
|
};
|
|
|
|
ignored_buffertypes = mkOption {
|
|
type = with types; listOf string;
|
|
default = [ "nofile" ];
|
|
};
|
|
|
|
};
|
|
config =
|
|
let
|
|
setup = helpers.toLuaObject {
|
|
inherit (cfg) show_jumps min_jump;
|
|
ignore_filetypes = attrsets.listToAttrs
|
|
(lib.lists.map (x: attrsets.nameValuePair x true)
|
|
cfg.ignored_filetypes);
|
|
ignore_buftypes = attrsets.listToAttrs
|
|
(lib.lists.map (x: attrsets.nameValuePair x true)
|
|
cfg.ignored_buffertypes);
|
|
popup = {
|
|
inherit (cfg) blend width;
|
|
delay_ms = cfg.delay;
|
|
inc_ms = cfg.increment;
|
|
fader = helpers.mkRaw (if cfg.fader.builtin == null then
|
|
cfg.fader.custom
|
|
else
|
|
''require("specs").${cfg.fader.builtin}'');
|
|
resizer = helpers.mkRaw (if cfg.resizer.builtin == null then
|
|
cfg.resizer.custom
|
|
else
|
|
''require("specs").${cfg.resizer.builtin}'');
|
|
};
|
|
};
|
|
in
|
|
mkIf cfg.enable {
|
|
extraPlugins = [ pkgs.vimPlugins.specs-nvim ];
|
|
|
|
extraConfigLua = ''
|
|
require('specs').setup(${setup})
|
|
'';
|
|
};
|
|
}
|