From c3533296201171cd85aa834d6d095c16cc5d9562 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Oct 2023 01:22:31 +0300 Subject: [PATCH 1/4] modules/visuals: add highlight-undo a plugin for highlighting undo/redo targets --- configuration.nix | 5 ++++- flake.nix | 5 +++++ lib/types/plugins.nix | 1 + modules/visuals/config.nix | 25 +++++++++++++++++++++++++ modules/visuals/visuals.nix | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 1 deletion(-) diff --git a/configuration.nix b/configuration.nix index 86e5faf..36816eb 100644 --- a/configuration.nix +++ b/configuration.nix @@ -79,14 +79,17 @@ inputs: let nvimWebDevicons.enable = true; scrollBar.enable = true; smoothScroll.enable = true; - cellularAutomaton.enable = isMaximal; + cellularAutomaton.enable = false; fidget-nvim.enable = true; + highlight-undo.enable = true; + indentBlankline = { enable = true; fillChar = null; eolChar = null; showCurrContext = true; }; + cursorline = { enable = true; lineTimeout = 0; diff --git a/flake.nix b/flake.nix index 914dc5c..ca96dda 100644 --- a/flake.nix +++ b/flake.nix @@ -368,6 +368,11 @@ flake = false; }; + highlight-undo = { + url = "github:tzachar/highlight-undo.nvim"; + flake = false; + }; + # Markdown glow-nvim = { url = "github:ellisonleao/glow.nvim"; diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index b189503..dcc5f79 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -94,6 +94,7 @@ with lib; let "copilot-cmp" "lsp-lines" "vim-dirtytalk" + "highlight-undo" ]; # You can either use the name of the plugin or a package. pluginType = with types; diff --git a/modules/visuals/config.nix b/modules/visuals/config.nix index 703f4dc..ab580ca 100644 --- a/modules/visuals/config.nix +++ b/modules/visuals/config.nix @@ -118,5 +118,30 @@ in { } ''; }) + + (mkIf cfg.highlight-undo.enable { + vim.startPlugins = ["highlight-undo"]; + vim.luaConfigRC.fidget-nvim = nvim.dag.entryAnywhere '' + require('highlight-undo').setup({ + duration = ${toString cfg.highlight-undo.duration}, + highlight_for_count = ${boolToString cfg.highlight-undo.highlightForCount}, + undo = { + hlgroup = ${cfg.highlight-undo.undo.hlGroup}, + mode = 'n', + lhs = 'u', + map = 'undo', + opts = {} + }, + + redo = { + hlgroup = ${cfg.highlight-undo.redo.hlGroup}, + mode = 'n', + lhs = '', + map = 'redo', + opts = {} + }, + }) + ''; + }) ]); } diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 0b7fd9e..41d2bdc 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -103,5 +103,40 @@ in { defaultText = literalExpression "config.vim.treesitter.enable"; }; }; + + highlight-undo = { + enable = mkEnableOption "highlight undo [highlight-undo]"; + + highlightForCount = mkOption { + type = types.bool; + default = true; + description = '' + Enable support for highlighting when a `` is provided before the key + If set to false it will only highlight when the mapping is not prefixed with a `` + ''; + }; + + duration = mkOption { + type = types.int; + description = "Duration of highlight"; + default = 200; + }; + + undo = { + hlGroup = mkOption { + type = types.str; + description = "Highlight group for undo"; + default = "HighlightUndo"; + }; + }; + + redo = { + hlGroup = mkOption { + type = types.str; + description = "Highlight group for redo"; + default = "HighlightUndo"; + }; + }; + }; }; } From 277bcf3a3fd74a4e7cf16dd7008e37e851b32651 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Oct 2023 01:22:43 +0300 Subject: [PATCH 2/4] flake: bump inputs --- flake.lock | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 68bf1c8..37b6d56 100644 --- a/flake.lock +++ b/flake.lock @@ -533,6 +533,22 @@ "type": "github" } }, + "highlight-undo": { + "flake": false, + "locked": { + "lastModified": 1695227852, + "narHash": "sha256-I1AwVYqpJNA3K1AwGy/VgPnbrYvX19qfI9bQFZNu1SU=", + "owner": "tzachar", + "repo": "highlight-undo.nvim", + "rev": "50a6884a8476be04ecce8f1c4ed692c5000ef0a1", + "type": "github" + }, + "original": { + "owner": "tzachar", + "repo": "highlight-undo.nvim", + "type": "github" + } + }, "hop-nvim": { "flake": false, "locked": { @@ -804,11 +820,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1696879762, - "narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=", + "lastModified": 1697723726, + "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a", + "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", "type": "github" }, "original": { @@ -1465,6 +1481,7 @@ "gesture-nvim": "gesture-nvim", "gitsigns-nvim": "gitsigns-nvim", "glow-nvim": "glow-nvim", + "highlight-undo": "highlight-undo", "hop-nvim": "hop-nvim", "icon-picker-nvim": "icon-picker-nvim", "indent-blankline": "indent-blankline", From d835d6bd03985db9fc63f6836ef9f231d10880e1 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Oct 2023 01:25:21 +0300 Subject: [PATCH 3/4] docs: update release notes --- docs/release-notes/rl-0.5.adoc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index 219d7f2..444ee39 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -6,27 +6,27 @@ === Changelog https://github.com/vagahbond[vagahbond]: -* Added phan language server for PHP. +* Added phan language server for PHP -* Added phpactor language server for PHP. +* Added phpactor language server for PHP https://github.com/horriblename[horriblename]: -* Added transparency support for tokyonight theme. +* Added transparency support for tokyonight theme -* Fixed a bug where cmp's close and scrollDocs mappings wasn't working. +* Fixed a bug where cmp's close and scrollDocs mappings wasn't working * Streamlined and simplified extra plugin API with the addition of <> -* Allow using command names in place of LSP packages to avoid automatic installation. +* Allow using command names in place of LSP packages to avoid automatic installation -* Add lua LSP and treesitter support, and neodev.nvim plugin support. +* Add lua LSP and treesitter support, and neodev.nvim plugin support https://github.com/amanse[amanse]: -* Added daily notes options for obsidian plugin. +* Added daily notes options for obsidian plugin -* Added jdt-language-server for Java. +* Added jdt-language-server for Java https://github.com/yavko[yavko]: @@ -36,9 +36,9 @@ https://github.com/yavko[yavko]: https://github.com/FrothyMarrow[frothymarrow]: -* Renamed `vim.visuals.cursorWordline` to <>. +* Renamed `vim.visuals.cursorWordline` to <> -* Added <> to display cursorline only in the presence of line numbers. +* Added <> to display cursorline only in the presence of line numbers https://github.com/notashelf[notashelf]: @@ -60,7 +60,9 @@ https://github.com/notashelf[notashelf]: * Added a configuration option for choosing the leader key -* The package used for neovim is now customizable by the user, using <>. For best results, always use an unwrapped package. +* The package used for neovim is now customizable by the user, using <>. For best results, always use an unwrapped package + +* Added highlight-undo plugin for highlighting undo/redo targets https://github.com/jacekpoz[jacekpoz]: @@ -75,3 +77,5 @@ https://github.com/ksonj[ksonj]: * Add support to change mappings to utility/surround * Add black-and-isort python formatter + +* Removed redundant "Enable ..." in `mkEnableOption` descriptions From b358bfdbd0bbffb58d2ce7a50e03fc88c23b7f90 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Oct 2023 01:54:56 +0300 Subject: [PATCH 4/4] docs: use literalAsciiDoc --- modules/visuals/visuals.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/visuals/visuals.nix b/modules/visuals/visuals.nix index 41d2bdc..aec8efa 100644 --- a/modules/visuals/visuals.nix +++ b/modules/visuals/visuals.nix @@ -110,9 +110,9 @@ in { highlightForCount = mkOption { type = types.bool; default = true; - description = '' - Enable support for highlighting when a `` is provided before the key - If set to false it will only highlight when the mapping is not prefixed with a `` + description = nvim.nmd.literalAsciiDoc '' + Enable support for highlighting when a is provided before the key + If set to false it will only highlight when the mapping is not prefixed with a ''; };