diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-23 12:44:44 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-10-23 12:44:44 +0200 |
commit | dd615b074e4e10cdfea6d11f80cb2b6629850b97 (patch) | |
tree | 24f24cd334319a4a361349cbe7d8ea3e007b2c4b /modules/home.legacy/conf/nvim/mappings/default.nix | |
parent | fix(modules/legacy/conf/nvim/mappings): Use the better `<C-Tab>` and `<S-C-Ta... (diff) | |
download | nixos-config-dd615b074e4e10cdfea6d11f80cb2b6629850b97.tar.gz nixos-config-dd615b074e4e10cdfea6d11f80cb2b6629850b97.zip |
feat(modules/legacy/conf/nvim/mappings): Ignore space only deletions
Diffstat (limited to 'modules/home.legacy/conf/nvim/mappings/default.nix')
-rw-r--r-- | modules/home.legacy/conf/nvim/mappings/default.nix | 20 |
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 = '' |