diff --git a/configuration.nix b/configuration.nix index f56061b..af5efec 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/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`. 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", 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"; 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 ]; } diff --git a/modules/plugins/utility/motion/precognition/config.nix b/modules/plugins/utility/motion/precognition/config.nix new file mode 100644 index 0000000..25fceda --- /dev/null +++ b/modules/plugins/utility/motion/precognition/config.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + ... +}: 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 { + config = + mkIf cfg.enable + { + vim.startPlugins = [ + "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}), + }); + ''; + }; +} diff --git a/modules/plugins/utility/motion/precognition/default.nix b/modules/plugins/utility/motion/precognition/default.nix new file mode 100644 index 0000000..d132710 --- /dev/null +++ b/modules/plugins/utility/motion/precognition/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./precognition.nix + ./config.nix + ]; +} diff --git a/modules/plugins/utility/motion/precognition/precognition.nix b/modules/plugins/utility/motion/precognition/precognition.nix new file mode 100644 index 0000000..9c42e0f --- /dev/null +++ b/modules/plugins/utility/motion/precognition/precognition.nix @@ -0,0 +1,65 @@ +{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 = { + 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 = mkHintType "What motions display and at what priority."; + + gutterHints = + mkHintType "What motions display and at what priority. Only appears in gutters."; + + disabled_fts = mkOption { + type = listOf str; + default = ["startify"]; + example = literalExpression ''["startify"]''; + }; + }; +}