diff --git a/plugins/by-name/peek/default.nix b/plugins/by-name/peek/default.nix new file mode 100644 index 00000000..e0bc4a43 --- /dev/null +++ b/plugins/by-name/peek/default.nix @@ -0,0 +1,32 @@ +{ lib, ... }: +lib.nixvim.plugins.mkNeovimPlugin { + name = "peek"; + packPathName = "peek.nvim"; + package = "peek-nvim"; + + maintainers = [ lib.maintainers.GaetanLepage ]; + + settingsExample = { + auto_load = false; + close_on_bdelete = false; + app = "google-chrome-stable"; + }; + + extraOptions = { + createUserCommands = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + description = '' + Whether to create the `PeekOpen` and `PeekClose` user commands. + ''; + }; + }; + + extraConfig = cfg: { + plugins.peek.luaConfig.post = lib.mkIf cfg.createUserCommands '' + vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) + vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) + ''; + }; +} diff --git a/tests/test-sources/plugins/by-name/peek/default.nix b/tests/test-sources/plugins/by-name/peek/default.nix new file mode 100644 index 00000000..4e786803 --- /dev/null +++ b/tests/test-sources/plugins/by-name/peek/default.nix @@ -0,0 +1,42 @@ +{ + empty = { + plugins.peek.enable = true; + }; + + defaults = { + plugins.peek = { + enable = true; + + settings = { + auto_load = true; + close_on_bdelete = true; + syntax = true; + theme = "dark"; + update_on_change = true; + app = "webview"; + filetype = [ "markdown" ]; + throttle_at = 200000; + throttle_time = "auto"; + }; + }; + }; + + example = { + plugins.peek = { + enable = true; + + settings = { + auto_load = false; + close_on_bdelete = false; + app = "google-chrome-stable"; + }; + }; + }; + + withoutUserCommands = { + plugins.peek = { + enable = true; + createUserCommands = false; + }; + }; +}