mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 01:08:43 +02:00
plugins/zk: init + tests (#340)
This commit is contained in:
parent
f8c412ba7f
commit
838f616f0a
3 changed files with 79 additions and 0 deletions
|
@ -100,5 +100,6 @@
|
||||||
./utils/emmet.nix
|
./utils/emmet.nix
|
||||||
./utils/magma-nvim.nix
|
./utils/magma-nvim.nix
|
||||||
./utils/which-key.nix
|
./utils/which-key.nix
|
||||||
|
./utils/zk.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
55
plugins/utils/zk.nix
Normal file
55
plugins/utils/zk.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
} @ args:
|
||||||
|
with lib; let
|
||||||
|
helpers = import ../helpers.nix args;
|
||||||
|
in {
|
||||||
|
options.plugins.zk = {
|
||||||
|
enable = mkEnableOption "zk.nvim, a plugin to integrate with zk";
|
||||||
|
|
||||||
|
package = helpers.mkPackageOption "zk.nvim" pkgs.vimPlugins.zk-nvim;
|
||||||
|
|
||||||
|
picker = helpers.defaultNullOpts.mkEnumFirstDefault ["select" "fzf" "telescope"] ''
|
||||||
|
it's recommended to use "telescope" or "fzf"
|
||||||
|
'';
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
config =
|
||||||
|
helpers.extraOptionsOptions
|
||||||
|
// {
|
||||||
|
cmd = helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["zk" "lsp"]'' "";
|
||||||
|
name = helpers.defaultNullOpts.mkStr "zk" "";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoAttach = {
|
||||||
|
enabled = helpers.defaultNullOpts.mkBool true "automatically attach buffers in a zk notebook";
|
||||||
|
filetypes =
|
||||||
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["markdown"]''
|
||||||
|
"matching the given filetypes";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = let
|
||||||
|
cfg = config.plugins.zk;
|
||||||
|
setupOptions = {
|
||||||
|
inherit (cfg) picker;
|
||||||
|
lsp = {
|
||||||
|
inherit (cfg.lsp) config;
|
||||||
|
auto_attach = {
|
||||||
|
inherit (cfg.lsp.autoAttach) enabled filetypes;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
extraPlugins = [cfg.package];
|
||||||
|
extraPackages = [pkgs.zk];
|
||||||
|
|
||||||
|
extraConfigLua = ''
|
||||||
|
require("zk").setup(${helpers.toLuaObject setupOptions})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
23
tests/test-sources/plugins/utils/zk.nix
Normal file
23
tests/test-sources/plugins/utils/zk.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.zk.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
plugins.zk = {
|
||||||
|
enable = true;
|
||||||
|
picker = "select";
|
||||||
|
lsp = {
|
||||||
|
config = {
|
||||||
|
cmd = ["zk" "lsp"];
|
||||||
|
name = "zk";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoAttach = {
|
||||||
|
enabled = true;
|
||||||
|
filetypes = ["markdown"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue