about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-23 12:44:44 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-23 12:44:44 +0200
commitdd615b074e4e10cdfea6d11f80cb2b6629850b97 (patch)
tree24f24cd334319a4a361349cbe7d8ea3e007b2c4b /modules/home.legacy/conf
parentfix(modules/legacy/conf/nvim/mappings): Use the better `<C-Tab>` and `<S-C-Ta... (diff)
downloadnixos-config-dd615b074e4e10cdfea6d11f80cb2b6629850b97.tar.gz
nixos-config-dd615b074e4e10cdfea6d11f80cb2b6629850b97.zip
feat(modules/legacy/conf/nvim/mappings): Ignore space only deletions
Diffstat (limited to '')
-rw-r--r--modules/home.legacy/conf/nvim/mappings/default.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/home.legacy/conf/nvim/mappings/default.nix b/modules/home.legacy/conf/nvim/mappings/default.nix
index 40f1a377..d422abf7 100644
--- a/modules/home.legacy/conf/nvim/mappings/default.nix
+++ b/modules/home.legacy/conf/nvim/mappings/default.nix
@@ -215,6 +215,26 @@
         options.desc = "delete without saving to register";
       }
       {
+        key = "x";
+        mode = ["n"];
+        action.__raw = ''
+          function()
+            local col = vim.api.nvim_win_get_cursor(0)[2]
+            local char = vim.api.nvim_get_current_line():sub(col+1,col+1)
+            if char:match("%s") then
+              return '"_x'
+            else
+              return "x"
+            end
+          end
+        '';
+        options = {
+          desc = "Pipe all space only deletions to the blackhole register";
+          expr = true;
+          silent = true;
+        };
+      }
+      {
         key = "dd";
         mode = ["n"];
         action.__raw = ''