From 7b17023780c5760b6b698b6b175c3fdd39fdbb94 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Sun, 3 Nov 2024 17:25:24 -0700 Subject: [PATCH 01/24] utility/precognition: init --- .../utility/motion/precognition/config.nix | 46 ++++++++++++ .../utility/motion/precognition/default.nix | 0 .../motion/precognition/precognition.nix | 71 +++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 modules/plugins/utility/motion/precognition/config.nix create mode 100644 modules/plugins/utility/motion/precognition/default.nix create mode 100644 modules/plugins/utility/motion/precognition/precognition.nix diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix new file mode 100644 index 0000000..f5aeb94 --- /dev/null +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -0,0 +1,46 @@ +{ + config, + lib, + ... +}: let + cfg = config.vim.utility.motion.precognition; + inherit (lib.modules) mkIf; + inherit (lib.nvim.dag) entryAnywhere; +in { + config = + mkIf cfg.enable + { + vim.startPlugins = [ + "precognition-nvim" + ]; + + vim.pluginRC.precognition-nvim = entryAnywhere '' + require("precognition").setup({ + startVisible = true, + showBlankVirtLine = true, + highlightColor = { link = "Comment" }, + hints = { + Caret = { text = "^", prio = 2 }, + Dollar = { text = "$", prio = 1 }, + MatchingPair = { text = "%", prio = 5 }, + Zero = { text = "0", prio = 1 }, + w = { text = "w", prio = 10 }, + b = { text = "b", prio = 9 }, + e = { text = "e", prio = 8 }, + W = { text = "W", prio = 7 }, + B = { text = "B", prio = 6 }, + E = { text = "E", prio = 5 }, + }, + gutterHints = { + G = { text = "G", prio = 10 }, + gg = { text = "gg", prio = 9 }, + PrevParagraph = { text = "{", prio = 8 }, + NextParagraph = { text = "}", prio = 8 }, + }, + disabled_fts = { + "startify", + }, + }) + ''; + }; +} diff --git a/modules/plugins/utility/motion/precognition/default.nix b/modules/plugins/utility/motion/precognition/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix new file mode 100644 index 0000000..de9bd63 --- /dev/null +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -0,0 +1,71 @@ +{ lib, ... }: + +let + inherit (lib.options) mkEnableOption mkOption literalExpression; + inherit (lib.types) attrsOf listOf str bool int submodule; + +in +{ + options.vim.utility.motion.precognition = rec { + enable = mkEnableOption "precognition.nvim plugin"; + + startVisible = mkOption { + type = bool; + description = "Whether to start 'precognition' automatically."; + default = true; + }; + + showBlankVirtLine = mkOption { + type = bool; + description = "Whether to show a blank virtual line when no movements are shown."; + default = true; + }; + + highlightColor = mkOption { + type = attrsOf str; + + example = literalExpression '' + { link = "Comment"; } + # or + { foreground = "#0000FF", background = "#000000" }; + ''; + default = { link = "Comment"; }; + description = "The highlight for the virtual text."; + }; + + hints = { + type = attrsOf (submodule { + options = { + text = mkOption { + type = str; + description = "The easier-to-read depiction of the motion."; + }; + prio = { + type = str; + description = "The priority of the hint."; + example = str; + }; + }; + }); + }; + + gutterHints = hints; + + disabled_fts = mkOption { + type = listOf str; + default = [ "startify" ]; + example = literalExpression ''[ "startify" ]''; + }; + + mappings = { + # enable = mkOption { + # }; + # + # disable = mkOption { + # }; + # + # toggle = mkOption { + # }; + }; + }; +} From 3682edd22e8358db7bd0a324bf129520384adac4 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Sun, 3 Nov 2024 17:36:39 -0700 Subject: [PATCH 02/24] utility/precognition: fix priority example, add default --- .../plugins/utility/motion/precognition/precognition.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index de9bd63..28d8670 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -3,7 +3,6 @@ let inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.types) attrsOf listOf str bool int submodule; - in { options.vim.utility.motion.precognition = rec { @@ -29,7 +28,7 @@ in # or { foreground = "#0000FF", background = "#000000" }; ''; - default = { link = "Comment"; }; + default = { link = "Comment"; }; description = "The highlight for the virtual text."; }; @@ -41,9 +40,10 @@ in description = "The easier-to-read depiction of the motion."; }; prio = { - type = str; + type = int; description = "The priority of the hint."; - example = str; + example = 10; + default = 1; }; }; }); From ffc8045d8c46cd89c4fb2b0a150e349f6c9dcfb9 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:00:09 -0700 Subject: [PATCH 03/24] utility/precognition: add files to default.nix --- modules/plugins/utility/motion/precognition/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/plugins/utility/motion/precognition/default.nix b/modules/plugins/utility/motion/precognition/default.nix index e69de29..d132710 100644 --- a/modules/plugins/utility/motion/precognition/default.nix +++ b/modules/plugins/utility/motion/precognition/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./precognition.nix + ./config.nix + ]; +} From a53a44bf135ac766facffbc5d44b92fc4390b574 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:06:41 -0700 Subject: [PATCH 04/24] utility/precognition: fix typos, manual fmt --- .../motion/precognition/precognition.nix | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 28d8670..8f588a5 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -1,22 +1,19 @@ -{ lib, ... }: - -let +{lib, ...}: let inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.types) attrsOf listOf str bool int submodule; -in -{ +in { options.vim.utility.motion.precognition = rec { enable = mkEnableOption "precognition.nvim plugin"; startVisible = mkOption { type = bool; - description = "Whether to start 'precognition' automatically."; + description = "Whether to start 'precognition' automatically."; default = true; }; showBlankVirtLine = mkOption { type = bool; - description = "Whether to show a blank virtual line when no movements are shown."; + description = "Whether to show a blank virtual line when no movements are shown."; default = true; }; @@ -26,9 +23,9 @@ in example = literalExpression '' { link = "Comment"; } # or - { foreground = "#0000FF", background = "#000000" }; + { foreground = "#0000FF"; background = "#000000"; }; ''; - default = { link = "Comment"; }; + default = {link = "Comment";}; description = "The highlight for the virtual text."; }; @@ -53,7 +50,7 @@ in disabled_fts = mkOption { type = listOf str; - default = [ "startify" ]; + default = ["startify"]; example = literalExpression ''[ "startify" ]''; }; From fab51c43549b365193740a717299535e40e82c28 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:09:38 -0700 Subject: [PATCH 05/24] utility/precognition: remove useless mappings i was going to add binds to toggle/enable/disable but ehhh idk --- .../utility/motion/precognition/precognition.nix | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 8f588a5..970f69b 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -53,16 +53,5 @@ in { default = ["startify"]; example = literalExpression ''[ "startify" ]''; }; - - mappings = { - # enable = mkOption { - # }; - # - # disable = mkOption { - # }; - # - # toggle = mkOption { - # }; - }; }; } From 121d375040b2ef8587a6e1b8dd6c32558a8ac1c2 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:12:07 -0700 Subject: [PATCH 06/24] utility/precognition: fix hints option it broke --- .../plugins/utility/motion/precognition/precognition.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 970f69b..40d1fb8 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -29,14 +29,16 @@ in { description = "The highlight for the virtual text."; }; - hints = { + hints = mkOption { + default = {}; + description = "What motions display and at what priority."; type = attrsOf (submodule { options = { text = mkOption { type = str; description = "The easier-to-read depiction of the motion."; }; - prio = { + prio = mkOption { type = int; description = "The priority of the hint."; example = 10; From 37e8dd9a3b92d3d537bd24293b210f39bf7e1978 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:12:41 -0700 Subject: [PATCH 07/24] utility/precognition: update gutter hints, new description --- modules/plugins/utility/motion/precognition/precognition.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 40d1fb8..2af702e 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -48,7 +48,8 @@ in { }); }; - gutterHints = hints; + gutterHints = hints // + { description = "What motions display and at what priority. Only appears in gutters."; }; disabled_fts = mkOption { type = listOf str; From 99019dc77318dd489fa1f18b5491d2ff741719fd Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:13:01 -0700 Subject: [PATCH 08/24] utility/precognition: add files to motion defaults --- modules/plugins/utility/motion/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/plugins/utility/motion/default.nix b/modules/plugins/utility/motion/default.nix index 925a33e..838fec7 100644 --- a/modules/plugins/utility/motion/default.nix +++ b/modules/plugins/utility/motion/default.nix @@ -2,5 +2,6 @@ _: { imports = [ ./hop ./leap + ./precognition ]; } From e7c411f4831c3ba53f44158a3c4f2b4e16848882 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:14:40 -0700 Subject: [PATCH 09/24] utility/precognition: add plugin to flake --- flake.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index 987e3e5..ed90093 100644 --- a/flake.nix +++ b/flake.nix @@ -525,6 +525,11 @@ flake = false; }; + plugin-precognition-nvim = { + url = "github:tris203/precognition.nvim"; + flake = false; + }; + # Note-taking plugin-obsidian-nvim = { url = "github:epwalsh/obsidian.nvim"; From 4c24c32269c73339a7446e0166117962292512cb Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:16:06 -0700 Subject: [PATCH 10/24] utility/precognition: remove comment reference oops --- .../utility/motion/precognition/config.nix | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix index f5aeb94..d3d627c 100644 --- a/modules/plugins/utility/motion/precognition/config.nix +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -3,9 +3,12 @@ lib, ... }: let - cfg = config.vim.utility.motion.precognition; inherit (lib.modules) mkIf; inherit (lib.nvim.dag) entryAnywhere; + inherit (lib.nvim.lua) toLuaObject; + inherit (builtins) toString; + + cfg = config.vim.utility.motion.precognition; in { config = mkIf cfg.enable @@ -16,31 +19,13 @@ in { vim.pluginRC.precognition-nvim = entryAnywhere '' require("precognition").setup({ - startVisible = true, - showBlankVirtLine = true, - highlightColor = { link = "Comment" }, - hints = { - Caret = { text = "^", prio = 2 }, - Dollar = { text = "$", prio = 1 }, - MatchingPair = { text = "%", prio = 5 }, - Zero = { text = "0", prio = 1 }, - w = { text = "w", prio = 10 }, - b = { text = "b", prio = 9 }, - e = { text = "e", prio = 8 }, - W = { text = "W", prio = 7 }, - B = { text = "B", prio = 6 }, - E = { text = "E", prio = 5 }, - }, - gutterHints = { - G = { text = "G", prio = 10 }, - gg = { text = "gg", prio = 9 }, - PrevParagraph = { text = "{", prio = 8 }, - NextParagraph = { text = "}", prio = 8 }, - }, - disabled_fts = { - "startify", - }, - }) + startVisible = ${toString cfg.startVisible}, + showBlankVirtLine = ${toString cfg.showBlankVirtLine}, + highlightColor = (${toLuaObject cfg.highlightColor}), --{ link = "Comment" }, + hints = (${toLuaObject cfg.hints}), + gutterHints = (${toLuaObject cfg.gutterHints}), + disabled_fts = (${toLuaObject cfg.disabled_fts}), + }); ''; }; } From 1b2b9763f47bdf05d924987f3031a161a4b44492 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:31:37 -0700 Subject: [PATCH 11/24] utility/precognition: add precognition to maximal configuration it does work! --- configuration.nix | 21 +++++++++++++++++++++ flake.lock | 17 +++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/configuration.nix b/configuration.nix index f56061b..804b215 100644 --- a/configuration.nix +++ b/configuration.nix @@ -165,6 +165,27 @@ isMaximal: { motion = { hop.enable = true; leap.enable = true; + + precognition = { + enable = true; + startVisible = true; + showBlankVirtLine = true; + + # highlightColor - automatically set by theme + disabled_fts = [ "startify" "alpha" "dashboard" ]; + gutterHints = { + gg = { + text = "gg"; + prio = 2; + }; + }; + hints = { + Caret = { + text = "^"; + prio = 10; + }; + }; + }; }; images = { diff --git a/flake.lock b/flake.lock index 7775fb1..0881cae 100644 --- a/flake.lock +++ b/flake.lock @@ -1421,6 +1421,22 @@ "type": "github" } }, + "plugin-precognition-nvim": { + "flake": false, + "locked": { + "lastModified": 1730325090, + "narHash": "sha256-onY1Aa+dwLR1wRua52hpSXj6zZOZXjkUlDjDa0xEEcE=", + "owner": "tris203", + "repo": "precognition.nvim", + "rev": "0189e8d6f96275a079b2805d68d49414871885cd", + "type": "github" + }, + "original": { + "owner": "tris203", + "repo": "precognition.nvim", + "type": "github" + } + }, "plugin-project-nvim": { "flake": false, "locked": { @@ -1880,6 +1896,7 @@ "plugin-otter-nvim": "plugin-otter-nvim", "plugin-oxocarbon": "plugin-oxocarbon", "plugin-plenary-nvim": "plugin-plenary-nvim", + "plugin-precognition-nvim": "plugin-precognition-nvim", "plugin-project-nvim": "plugin-project-nvim", "plugin-registers": "plugin-registers", "plugin-rose-pine": "plugin-rose-pine", From 7df01d1cf6f6359722ce5cc5c63eed435b10a157 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:42:12 -0700 Subject: [PATCH 12/24] utility/precognition: update descriptions needs docs link, desc is somewhat obscure. --- .../motion/precognition/precognition.nix | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 2af702e..6e0d31a 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -26,12 +26,22 @@ in { { foreground = "#0000FF"; background = "#000000"; }; ''; default = {link = "Comment";}; - description = "The highlight for the virtual text."; + description = '' + The highlight for the virtual text. + + To find more about this option, please see + [the documentation](https://github.com/tris203/precognition.nvim). + ''; }; hints = mkOption { default = {}; - description = "What motions display and at what priority."; + description = '' + What motions display and at what priority."; + + To find more about this option, please see + [the documentation](https://github.com/tris203/precognition.nvim). + ''; type = attrsOf (submodule { options = { text = mkOption { @@ -49,12 +59,19 @@ in { }; gutterHints = hints // - { description = "What motions display and at what priority. Only appears in gutters."; }; + { + description = '' + What motions display and at what priority. Only appears in gutters. + + To find more about this option, please see + [the documentation](https://github.com/tris203/precognition.nvim). + ''; + }; disabled_fts = mkOption { type = listOf str; default = ["startify"]; - example = literalExpression ''[ "startify" ]''; + example = literalExpression ''["startify"]''; }; }; } From 93c45372733a1b3df7690cb5c11f009ad8bcc471 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:48:08 -0700 Subject: [PATCH 13/24] docs: add credit to release notes --- docs/release-notes/rl-0.7.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index 7023371..a8c2a01 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -216,3 +216,7 @@ everyone. [Bloxx12](https://github.com/Bloxx12): - Fix internal breakage in `elixir-tools` setup. + +[Nowaaru](https://github.com/Nowaaru): + +- Add `precognition-nvim`. From cb4500b9c7a6893c43d91304c081ef090d60f5c7 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 00:48:31 -0700 Subject: [PATCH 14/24] utility/precognition: format --- configuration.nix | 8 ++++---- modules/plugins/utility/motion/precognition/config.nix | 2 +- .../plugins/utility/motion/precognition/precognition.nix | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/configuration.nix b/configuration.nix index 804b215..af5efec 100644 --- a/configuration.nix +++ b/configuration.nix @@ -168,20 +168,20 @@ isMaximal: { precognition = { enable = true; - startVisible = true; + startVisible = true; showBlankVirtLine = true; # highlightColor - automatically set by theme - disabled_fts = [ "startify" "alpha" "dashboard" ]; + disabled_fts = ["startify" "alpha" "dashboard"]; gutterHints = { gg = { - text = "gg"; + text = "gg"; prio = 2; }; }; hints = { Caret = { - text = "^"; + text = "^"; prio = 10; }; }; diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix index d3d627c..25fceda 100644 --- a/modules/plugins/utility/motion/precognition/config.nix +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -19,7 +19,7 @@ in { vim.pluginRC.precognition-nvim = entryAnywhere '' require("precognition").setup({ - startVisible = ${toString cfg.startVisible}, + startVisible = ${toString cfg.startVisible}, showBlankVirtLine = ${toString cfg.showBlankVirtLine}, highlightColor = (${toLuaObject cfg.highlightColor}), --{ link = "Comment" }, hints = (${toLuaObject cfg.hints}), diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 6e0d31a..f1c701c 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -58,8 +58,9 @@ in { }); }; - gutterHints = hints // - { + gutterHints = + hints + // { description = '' What motions display and at what priority. Only appears in gutters. From 0b647a209db5acd709506df510e0d9fea26aa7a3 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 21:14:55 -0700 Subject: [PATCH 15/24] utility/precognition: de-linkify descriptions --- .../plugins/utility/motion/precognition/precognition.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index f1c701c..70e12a2 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -28,9 +28,6 @@ in { default = {link = "Comment";}; description = '' The highlight for the virtual text. - - To find more about this option, please see - [the documentation](https://github.com/tris203/precognition.nvim). ''; }; @@ -38,9 +35,6 @@ in { default = {}; description = '' What motions display and at what priority."; - - To find more about this option, please see - [the documentation](https://github.com/tris203/precognition.nvim). ''; type = attrsOf (submodule { options = { @@ -63,9 +57,6 @@ in { // { description = '' What motions display and at what priority. Only appears in gutters. - - To find more about this option, please see - [the documentation](https://github.com/tris203/precognition.nvim). ''; }; From 39e27e17a2a63a5de7016a70bb2dcaf1180c1195 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 21:21:32 -0700 Subject: [PATCH 16/24] utility/precognition: no more rec --- .../motion/precognition/precognition.nix | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 70e12a2..9c42e0f 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -1,8 +1,28 @@ {lib, ...}: let inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.types) attrsOf listOf str bool int submodule; + + mkHintType = description: + mkOption { + inherit description; + default = {}; + type = attrsOf (submodule { + options = { + text = mkOption { + type = str; + description = "The easier-to-read depiction of the motion."; + }; + prio = mkOption { + type = int; + description = "The priority of the hint."; + example = 10; + default = 1; + }; + }; + }); + }; in { - options.vim.utility.motion.precognition = rec { + options.vim.utility.motion.precognition = { enable = mkEnableOption "precognition.nvim plugin"; startVisible = mkOption { @@ -31,34 +51,10 @@ in { ''; }; - hints = mkOption { - default = {}; - description = '' - What motions display and at what priority."; - ''; - type = attrsOf (submodule { - options = { - text = mkOption { - type = str; - description = "The easier-to-read depiction of the motion."; - }; - prio = mkOption { - type = int; - description = "The priority of the hint."; - example = 10; - default = 1; - }; - }; - }); - }; + hints = mkHintType "What motions display and at what priority."; gutterHints = - hints - // { - description = '' - What motions display and at what priority. Only appears in gutters. - ''; - }; + mkHintType "What motions display and at what priority. Only appears in gutters."; disabled_fts = mkOption { type = listOf str; From 517a6aa06e40a9e66755f348ff15aa9dede822a3 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Mon, 4 Nov 2024 23:40:44 -0700 Subject: [PATCH 17/24] utility/precognition: convert to setupOpts honestly raf was cooking with this one. it's much nicer to use compared to interpolation lol --- configuration.nix | 28 ++++---- .../utility/motion/precognition/config.nix | 14 +--- .../motion/precognition/precognition.nix | 64 ++++++++++--------- 3 files changed, 51 insertions(+), 55 deletions(-) diff --git a/configuration.nix b/configuration.nix index af5efec..29179ee 100644 --- a/configuration.nix +++ b/configuration.nix @@ -168,21 +168,23 @@ isMaximal: { precognition = { enable = true; - startVisible = true; - showBlankVirtLine = true; + setupOpts = { + startVisible = true; + showBlankVirtLine = true; - # highlightColor - automatically set by theme - disabled_fts = ["startify" "alpha" "dashboard"]; - gutterHints = { - gg = { - text = "gg"; - prio = 2; + # highlightColor - automatically set by theme + disabled_fts = ["startify" "alpha" "dashboard"]; + gutterHints = { + gg = { + text = "gg"; + prio = 2; + }; }; - }; - hints = { - Caret = { - text = "^"; - prio = 10; + hints = { + Caret = { + text = "^"; + prio = 10; + }; }; }; }; diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix index 25fceda..6535e33 100644 --- a/modules/plugins/utility/motion/precognition/config.nix +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -4,9 +4,6 @@ ... }: let inherit (lib.modules) mkIf; - inherit (lib.nvim.dag) entryAnywhere; - inherit (lib.nvim.lua) toLuaObject; - inherit (builtins) toString; cfg = config.vim.utility.motion.precognition; in { @@ -17,15 +14,8 @@ in { "precognition-nvim" ]; - vim.pluginRC.precognition-nvim = entryAnywhere '' - require("precognition").setup({ - startVisible = ${toString cfg.startVisible}, - showBlankVirtLine = ${toString cfg.showBlankVirtLine}, - highlightColor = (${toLuaObject cfg.highlightColor}), --{ link = "Comment" }, - hints = (${toLuaObject cfg.hints}), - gutterHints = (${toLuaObject cfg.gutterHints}), - disabled_fts = (${toLuaObject cfg.disabled_fts}), - }); + vim.luaConfigRC.precognition = lib.nvim.dag.entryAnywhere '' + require('precognition').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts}) ''; }; } diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 9c42e0f..8e60184 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -1,6 +1,8 @@ -{lib, ...}: let +{lib, ...}: +let inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.types) attrsOf listOf str bool int submodule; + inherit (lib.nvim.types) mkPluginSetupOption; mkHintType = description: mkOption { @@ -25,41 +27,43 @@ in { options.vim.utility.motion.precognition = { enable = mkEnableOption "precognition.nvim plugin"; - startVisible = mkOption { - type = bool; - description = "Whether to start 'precognition' automatically."; - default = true; - }; + setupOpts = mkPluginSetupOption "precognition.nvim" { + startVisible = mkOption { + type = bool; + description = "Whether to start 'precognition' automatically."; + default = true; + }; - showBlankVirtLine = mkOption { - type = bool; - description = "Whether to show a blank virtual line when no movements are shown."; - default = true; - }; + showBlankVirtLine = mkOption { + type = bool; + description = "Whether to show a blank virtual line when no movements are shown."; + default = true; + }; - highlightColor = mkOption { - type = attrsOf str; + highlightColor = mkOption { + type = attrsOf str; - example = literalExpression '' - { link = "Comment"; } - # or - { foreground = "#0000FF"; background = "#000000"; }; - ''; - default = {link = "Comment";}; - description = '' - The highlight for the virtual text. - ''; - }; + example = literalExpression '' + { link = "Comment"; } + # or + { foreground = "#0000FF"; background = "#000000"; }; + ''; + default = {link = "Comment";}; + description = '' + The highlight for the virtual text. + ''; + }; - hints = mkHintType "What motions display and at what priority."; + hints = mkHintType "What motions display and at what priority."; - gutterHints = - mkHintType "What motions display and at what priority. Only appears in gutters."; + gutterHints = + mkHintType "What motions display and at what priority. Only appears in gutters."; - disabled_fts = mkOption { - type = listOf str; - default = ["startify"]; - example = literalExpression ''["startify"]''; + disabled_fts = mkOption { + type = listOf str; + default = ["startify"]; + example = literalExpression ''["startify"]''; + }; }; }; } From b0641a8c0b4e1384af0c2017ca659883befa93d2 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Tue, 5 Nov 2024 04:13:22 -0700 Subject: [PATCH 18/24] utility/precognition: remove unnecessary function parameter --- modules/plugins/utility/motion/precognition/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/utility/motion/precognition/default.nix b/modules/plugins/utility/motion/precognition/default.nix index d132710..85d223c 100644 --- a/modules/plugins/utility/motion/precognition/default.nix +++ b/modules/plugins/utility/motion/precognition/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./precognition.nix ./config.nix From e43b18cb9f3bd41fa1edf9823493073ddc859d7b Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Tue, 5 Nov 2024 04:15:03 -0700 Subject: [PATCH 19/24] utility/precognition: format --- .../plugins/utility/motion/precognition/precognition.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 8e60184..b387d7f 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -1,5 +1,4 @@ -{lib, ...}: -let +{lib, ...}: let inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.types) attrsOf listOf str bool int submodule; inherit (lib.nvim.types) mkPluginSetupOption; @@ -42,13 +41,12 @@ in { highlightColor = mkOption { type = attrsOf str; - + default = {link = "Comment";}; example = literalExpression '' { link = "Comment"; } # or { foreground = "#0000FF"; background = "#000000"; }; ''; - default = {link = "Comment";}; description = '' The highlight for the virtual text. ''; From 3c1f89984ca6314d9c941e2b955d3b1997fbec6a Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Wed, 6 Nov 2024 16:32:40 -0700 Subject: [PATCH 20/24] utility/precognition: add description to disabled_fts oops --- modules/plugins/utility/motion/precognition/precognition.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index b387d7f..6d4bdd9 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -59,6 +59,7 @@ in { disabled_fts = mkOption { type = listOf str; + description = "Filetypes that automatically disable 'precognition.'"; default = ["startify"]; example = literalExpression ''["startify"]''; }; From c20bfdd6dcf1a9f71e1e363ea96dbae0ed854574 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Wed, 6 Nov 2024 22:44:37 -0700 Subject: [PATCH 21/24] utility/precognition: manual format --- modules/plugins/utility/motion/precognition/config.nix | 4 +--- modules/plugins/utility/motion/precognition/precognition.nix | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix index 6535e33..1db5625 100644 --- a/modules/plugins/utility/motion/precognition/config.nix +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -10,9 +10,7 @@ in { config = mkIf cfg.enable { - vim.startPlugins = [ - "precognition-nvim" - ]; + vim.startPlugins = [ "precognition-nvim" ]; vim.luaConfigRC.precognition = lib.nvim.dag.entryAnywhere '' require('precognition').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts}) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 6d4bdd9..9f14e90 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -54,8 +54,9 @@ in { hints = mkHintType "What motions display and at what priority."; - gutterHints = - mkHintType "What motions display and at what priority. Only appears in gutters."; + gutterHints = mkHintType '' + What motions display and at what priority. Only appears in gutters + ''; disabled_fts = mkOption { type = listOf str; From f013656dab1da458bad2a6eeb04ca959f5f38b48 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Wed, 6 Nov 2024 22:45:02 -0700 Subject: [PATCH 22/24] utility/precognition: remove periods at the end of descriptions --- .../utility/motion/precognition/precognition.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix index 9f14e90..25fedd8 100644 --- a/modules/plugins/utility/motion/precognition/precognition.nix +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -11,11 +11,11 @@ options = { text = mkOption { type = str; - description = "The easier-to-read depiction of the motion."; + description = "The easier-to-read depiction of the motion"; }; prio = mkOption { type = int; - description = "The priority of the hint."; + description = "The priority of the hint"; example = 10; default = 1; }; @@ -29,13 +29,13 @@ in { setupOpts = mkPluginSetupOption "precognition.nvim" { startVisible = mkOption { type = bool; - description = "Whether to start 'precognition' automatically."; + description = "Whether to start 'precognition' automatically"; default = true; }; showBlankVirtLine = mkOption { type = bool; - description = "Whether to show a blank virtual line when no movements are shown."; + description = "Whether to show a blank virtual line when no movements are shown"; default = true; }; @@ -48,11 +48,11 @@ in { { foreground = "#0000FF"; background = "#000000"; }; ''; description = '' - The highlight for the virtual text. + The highlight for the virtual text ''; }; - hints = mkHintType "What motions display and at what priority."; + hints = mkHintType "What motions display and at what priority"; gutterHints = mkHintType '' What motions display and at what priority. Only appears in gutters @@ -60,7 +60,8 @@ in { disabled_fts = mkOption { type = listOf str; - description = "Filetypes that automatically disable 'precognition.'"; + description = "Filetypes that automatically disable 'precognition'"; + default = ["startify"]; example = literalExpression ''["startify"]''; }; From 80ca761639c732dde68b780ce9161bfa1da80d80 Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Wed, 6 Nov 2024 22:46:34 -0700 Subject: [PATCH 23/24] utility/precognition: fix configuration.nix entry oops lol --- configuration.nix | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/configuration.nix b/configuration.nix index 29179ee..c3e5722 100644 --- a/configuration.nix +++ b/configuration.nix @@ -165,29 +165,7 @@ isMaximal: { motion = { hop.enable = true; leap.enable = true; - - precognition = { - enable = true; - setupOpts = { - startVisible = true; - showBlankVirtLine = true; - - # highlightColor - automatically set by theme - disabled_fts = ["startify" "alpha" "dashboard"]; - gutterHints = { - gg = { - text = "gg"; - prio = 2; - }; - }; - hints = { - Caret = { - text = "^"; - prio = 10; - }; - }; - }; - }; + precognition.enable = isMaximal; }; images = { From 18e27eb0bbb8e7bcc40f876331f6165786f5cbdf Mon Sep 17 00:00:00 2001 From: Nowaaru Date: Wed, 6 Nov 2024 22:47:44 -0700 Subject: [PATCH 24/24] utility/precognition: format --- modules/plugins/utility/motion/precognition/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix index 1db5625..bfeed8f 100644 --- a/modules/plugins/utility/motion/precognition/config.nix +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -10,7 +10,7 @@ in { config = mkIf cfg.enable { - vim.startPlugins = [ "precognition-nvim" ]; + vim.startPlugins = ["precognition-nvim"]; vim.luaConfigRC.precognition = lib.nvim.dag.entryAnywhere '' require('precognition').setup(${lib.nvim.lua.toLuaObject cfg.setupOpts})