diff --git a/pkgs/nvim/config/keymaps.nix b/pkgs/nvim/config/keymaps.nix index 64dd1bb..5e5490d 100644 --- a/pkgs/nvim/config/keymaps.nix +++ b/pkgs/nvim/config/keymaps.nix @@ -4,6 +4,111 @@ # TODO: Move general mappings to which-key keymaps = [ + # better up/down + { + mode = ["n" "x"]; + key = "j"; + action = "v:count == 0 ? 'gj' : 'j'"; + options = { + desc = "Down"; + expr = true; + silent = true; + }; + } + { + mode = ["n" "x"]; + key = ""; + action = "v:count == 0 ? 'gj' : 'j'"; + options = { + desc = "Down"; + expr = true; + silent = true; + }; + } + { + mode = ["n" "x"]; + key = "k"; + action = "v:count == 0 ? 'gk' : 'k'"; + options = { + desc = "Up"; + expr = true; + silent = true; + }; + } + { + mode = ["n" "x"]; + key = ""; + action = "v:count == 0 ? 'gk' : 'k'"; + options = { + desc = "Up"; + expr = true; + silent = true; + }; + } + + # Move to window using the hjkl keys + { + mode = "n"; + key = ""; + action = "h"; + options = { + desc = "Go to Left Window"; + remap = true; + }; + } + { + mode = "n"; + key = ""; + action = "j"; + options = { + desc = "Go to Lower Window"; + remap = true; + }; + } + { + mode = "n"; + key = ""; + action = "k"; + options = { + desc = "Go to Upper Window"; + remap = true; + }; + } + { + mode = "n"; + key = ""; + action = "l"; + options = { + desc = "Go to Right Window"; + remap = true; + }; + } + + # Resize window using arrow keys + { + mode = "n"; + key = ""; + action = "resize +2"; + options = {desc = "Increase Window Height";}; + } + { + mode = "n"; + key = ""; + action = "resize -2"; + options = {desc = "Decrease Window Height";}; + } + { + mode = "n"; + key = ""; + action = "vertical resize -2"; + options = {desc = "Decrease Window Width";}; + } + { + mode = "n"; + key = ""; + action = "vertical resize +2"; + options = {desc = "Increase Window Width";}; + } # Disable arrow keys { mode = ["n" "i"];