From 98644a34abcda94b8bed8ecaeec8be6edc657a09 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 2 May 2025 00:47:09 +0200 Subject: [PATCH] plugins/origami: init --- plugins/by-name/origami/default.nix | 18 +++++++ .../plugins/by-name/origami/default.nix | 48 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 plugins/by-name/origami/default.nix create mode 100644 tests/test-sources/plugins/by-name/origami/default.nix diff --git a/plugins/by-name/origami/default.nix b/plugins/by-name/origami/default.nix new file mode 100644 index 00000000..1d821c05 --- /dev/null +++ b/plugins/by-name/origami/default.nix @@ -0,0 +1,18 @@ +{ lib, ... }: +lib.nixvim.plugins.mkNeovimPlugin { + name = "origami"; + packPathName = "nvim-origami"; + package = "nvim-origami"; + + maintainers = [ lib.maintainers.GaetanLepage ]; + + # Ensures `nvim-ufo` (if enabled) is loaded before `origami` + # Default priority is 1000, mkBefore is 500 and mkAfter is 1500 + configLocation = lib.mkOrder 1100 "extraConfigLua"; + + settingsExample = { + keepFoldsAcrossSessions = true; + pauseFoldsOnSearch = true; + setupFoldKeymaps = false; + }; +} diff --git a/tests/test-sources/plugins/by-name/origami/default.nix b/tests/test-sources/plugins/by-name/origami/default.nix new file mode 100644 index 00000000..4b5810a2 --- /dev/null +++ b/tests/test-sources/plugins/by-name/origami/default.nix @@ -0,0 +1,48 @@ +{ + empty = { + plugins.origami.enable = true; + }; + + defaults = { + plugins.origami = { + enable = true; + + settings = { + keepFoldsAcrossSessions.__raw = "package.loaded['ufo'] ~= nil"; + pauseFoldsOnSearch = true; + foldtextWithLineCount = { + enabled.__raw = "package.loaded['ufo'] == nil"; + template = " %s lines"; + hlgroupForCount = "Comment"; + }; + foldKeymaps = { + setup = true; + hOnlyOpensOnFirstColumn = false; + }; + autoFold = { + enabled = false; + kinds = [ + "comment" + "imports" + ]; + }; + }; + }; + }; + + example = { + plugins = { + nvim-ufo.enable = true; + + origami = { + enable = true; + + settings = { + keepFoldsAcrossSessions = true; + pauseFoldsOnSearch = true; + setupFoldKeymaps = false; + }; + }; + }; + }; +}