From dd615b074e4e10cdfea6d11f80cb2b6629850b97 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 23 Oct 2024 12:44:44 +0200 Subject: feat(modules/legacy/conf/nvim/mappings): Ignore space only deletions --- modules/home.legacy/conf/nvim/mappings/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'modules/home.legacy') 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 @@ -214,6 +214,26 @@ action = "\"_d"; 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"]; -- cgit 1.4.1